Spring MVC,表单动作中的子文件夹
我有问题,如何在操作属性中创建 uri。我必须使用子文件夹作为“用户”、“管理员”,因为我使用 Spring Security。
<form:form action="/user/reservationTour.html" method="post" commandName="bookTourForm">
结果,无项目名称 http://localhost:8080/user/reservationTour.html
<form:form action="user/reservationTour.html" method="post" commandName="bookTourForm">
结果,2x链接中的用户 http://localhost:8080/ProjectContextTitle/user/user/reservationTour.html
<form:form action="<c:url value="/user/reservationTour.html" />" method="post" commandName="bookTourForm">
结果,异常
org.apache.jasper.JasperException: /jsp/user/reservationTourPage.jsp(7,33) Unterminated <form:form tag
这工作正常,但肯定不是一个好的解决方案
<form:form action="/ProjectContextName/user/reservationTour.html" method="post" commandName="bookTourForm">
I have problem, how to create uri in action attribute. I have to use subfolders as "user", "admin" because I use Spring Security.
<form:form action="/user/reservationTour.html" method="post" commandName="bookTourForm">
Result, no project name http://localhost:8080/user/reservationTour.html
<form:form action="user/reservationTour.html" method="post" commandName="bookTourForm">
Result, 2x user in link http://localhost:8080/ProjectContextTitle/user/user/reservationTour.html
<form:form action="<c:url value="/user/reservationTour.html" />" method="post" commandName="bookTourForm">
Result, exception
org.apache.jasper.JasperException: /jsp/user/reservationTourPage.jsp(7,33) Unterminated <form:form tag
This works fine, but sure not good solution
<form:form action="/ProjectContextName/user/reservationTour.html" method="post" commandName="bookTourForm">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已经在用户目录中,则只需使用相对 URL:
如果您想使用绝对 URL,请使用
,但不要将其包含在另一个 JSP 标记的属性:这是非法的。If you're already in the user directory, you just need to use a relative URL:
If you want to use an absolute URL, use
<c:url>
, but don't include it in the attribute of another JSP tag: that's illegal.