Handling end-of-URL slashes in Struts2 actions -


in struts.xml have following configured in order handle redirection of myhost.com/admin , myhost.com/admin/ correctly:

<constant name="struts.enable.slashesinactionnames" value="true"/>  <action name="admin">     <result type="redirectaction">admin/home</result> </action> <action name="admin/">     <result type="redirectaction">admin/home</result> </action> 

is there quicker way in struts2?

you mixing 2 things: action , namespace. can use below config:

<action name="admin">     <result type="redirectaction">admin/</result> </action> <action name="" namespace="admin">     <result>/admin/index.jsp</result> </action> 

Comments