我期待我的代碼重新設置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