管理 Spring MVC 中的映射
在 Spring 注解中使用映射的正确方法是什么?在提交表单时,有时会将表单提交到 /controller_name/store,有时会提交到 /store。我该如何管理此类错误。我哪里出错了?
What is the correct way to use Mappings in Spring Annotations? While submitting forms sometimes it happened that form is sumitted to /controller_name/store and sometimes to /store. How do I manage such errors. Where am I going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是,这是由于 JSP 中混合了绝对和相对链接/路径,和/或没有考虑“当前”页面和您想要访问的页面的相对位置所致。
My guess is that this caused by having a mixture of absolute and relative links / paths in your JSPs, and / or not considering the relative locations of the "current" page and the page you want to go to.
这取决于您的 html 表单
action
标记。当以/
开头时,表单数据将转到http://domain/{ACTION}
,当action不带/
时将附加到站点当前地址。It depends on your html form
action
tag. When it is start with/
, your form data will go tohttp://domain/{ACTION}
, when action is without/
it will be appended to site current address.