url mapping - Reuse method defined under another xml Struts2 -


here sample 2 xmls.

email.xml:

<action name="mailselect" class="com.my.emailaction">     <result name="success">mailselect.jsp</result> </action> 

i want use same method call defined in email.xml in xml.

another.xml:

<action name="mailselect" class="com.my.emailaction">     <result name="success">/email/mailselect.jsp</result> </action> 

when tried call, action being called http://localhost:8080/test/web/another/mailselect instead of correct http://localhost:8080/test/web/email/mailselect.

any way reuse same method in xml?

to make sure action names don't clashes should configure them in different namespaces.

<package name="email" namespace="/web/email" extends="struts-default">   <action name="mailselect" class="com.my.emailaction">     <result name="success">/email/mailselect.jsp</result>   </action> </package>  <package name="another" namespace="/web/another" extends="struts-default">   <action name="mailselect" class="com.my.emailaction">     <result name="success">mailselect.jsp</result>   </action> </package> 

for better understanding namespaces @ struts 2 namespace configuration example , explanation tutorial.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -