问题描述
- form表单提交将a标签的href属性值一起提交
-
jsp简单代码如下:<form id="f" method="post"> <a href="/xyz?pageNo=1"></a> </form> $("#f").attr("action","isShow.do?pageNo=1").submit();
使用js进行表单提交,url含有与form表单内的a标签同名参数pageNo。
在后台使用sprinmvc接收时,报Resolving exception from handler [cn.itcast.core.controller.admin.ProductController@40102291]: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String[]' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "1,1" 错误。
试了将其中一个pageNo改名,则后台springmvc正常接受。那么,也就是说,form表单提交时,也会把a标签的href属性值一起提交,为什么?
如果不想将其中一个pageNo改名,应该如何解决!
搞了我一个晚上,才发现问题,求助,谢谢!
解决方案
http://blog.163.com/yangyunan_7960/blog/static/35236306201062082237104/
解决方案二:
http://www.cnblogs.com/iLoveMyD/archive/2012/08/16/2642115.html
解决方案三:
http://jiangjingxiaoxuan.iteye.com/blog/1171862
解决方案四:
document.getElementById(key).value = value;
document.getElementById("argform").submit();
解决方案五:
唉,都没能理解我的意思,看来是我表达太烂了,不过,大概已经解决了。谢谢各位的热心帮忙。
解决方案六:
不知道喔理解的对不对,你的form表单中只有a标签,要提交表单,你就得点击a标签,那么可想而知。。。