- 哪一位大神能讲讲: js如何阻止在地址栏中敲击回车,java代码,SpringMVC 框架?
-
局部代码
<form id="accountForm" style="display: none;" method="post"> <input id="appName" name="name" type="hidden"/> <input type="hidden" name="isView" value="false"/> </form>
这个from表单里面设置了两个属性
<td width="20%" class="right" style="text-align: center;"> <c:choose> <c:when test="${personModel.cfapp21!=null && personModel.cfapp21!=''}"> <a href="javascript:managerAccount('${entry.name }')"> <img title="<spring:message code='ui.label.update.account'/>" src="${contextPath}/images/icon/edit.png"/> </a> </c:when>
这个是获得appName的值
function managerAccount(appName) { $("#appName").val(appName); $("#accountForm").attr("action", "${contextPath}/account/editPersonalAccount"); $("#accountForm").submit(); Para.showLoading(); }
@RequestMapping("/editPersonalAccount") public ModelAndView editPersonalAccount(@RequestParam("name") String appName, boolean isView,HttpServletResponse response) throws RemoteException, ApplicationException { ```这个是后台接收路径的方法。 使用的是java代码,SpringMVC框架。 从前面<a>标签点击到跳转到下一个页面都没问题,但是在跳转到下一个页面之后重新在浏览器的地址栏中敲击回车,就会报错。 错误信息如下 org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'name' is not present ps:小弟实在是不知道怎么办,不管是禁止地址栏中敲击回车 ,还是避免报错 只要其中一种解决方法就行了。小弟在此拜上。求各位大神帮帮忙,万分火急