我期待我的代码重新设置URL,并将其显示如下(有/)如何使用struts2重写URL地址?
http://www.example.com/myProject/Profile/view.action
http://www.example.com/myProject/Profile/edit.action
,但它们显示为以下(含_)
http://www.example.com/myProject/Profile_view.action
http://www.example.com/myProject/Profile_edit.action
为了实现这个,我改变在“_”,以“/”在我的struts.xml文件,但它不工作
<action name="Profile/*" method="{1}" class="com.controller.Profile">
<result name="view" tiles="viewProfile">viewProfile</result>
<result name="edit" tiles="editProfile">editProfile</result>
</action>
我打电话,使用下面的代码
<a href="Profile/view.action" >Profile</a>
请让我知道是否有其他方法来实现它。
我有同样的问题:( – 2013-02-14 05:44:15
更改后_你/重新启动了网络应用程序吗?无论如何,除非将struts.enable.SlashesInActionNames设置为true,否则不应该在操作名称中使用斜杠。你做到了? – Quaternion 2013-02-14 06:19:19
我不明白它是一个正确的URL,地址的URL格式是不正确的,还是你需要一个格式化URL的规范? – 2013-02-14 11:32:57