spring3 - 改变动作方法
在带有注释的 Spring 上,是否可以在不使用 javascript 更改操作的情况下更改表单操作?
例如,在控制器上调用的 Submit1 方法 = method1
在控制器上调用submit2方法= method2
@RequestMapping("/submit1")
public String submit1()
@RequestMapping("/submit2")
public String submit2()
...
<form:form id="dynamicfrm" method="post" action="archive/submit.do" commandName="submit">
<input type="submit1" value="">
<input type="submit2" value="">
谢谢!
On Spring with annotations, is there anyway that i can change the form action without changing the action using javascript?
For example on submit1 method invoked on the controller = method1
on submit2 method invoked on the controller = method2
@RequestMapping("/submit1")
public String submit1()
@RequestMapping("/submit2")
public String submit2()
...
<form:form id="dynamicfrm" method="post" action="archive/submit.do" commandName="submit">
<input type="submit1" value="">
<input type="submit2" value="">
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确 - 正如其他人已经说过的那样,这并不绝对清楚 - 比您想要根据单击的按钮将一个表单映射到不同的操作方法。
在 JSP 中,您可以将代码更改为如下所示:
在控制器中,您可以缩小映射范围,如下所示:
If I understand you correctly - as others already said it isn't absolutely clear - than you want to map one single form to different action methods dependending on the button that was clicked.
In your JSP you can change the code to something like this:
And in your controller you can narrow the mappings like this: