In the Web, if you need multiple action with the same name, you can manage the action by using namespaces. See the following examples in detail:
Project name: Strutsdemo, in the configuration Struts.xml, mainly in package to join namespace= "* * *", see Example 2.
1, 1<?xml version= "1.0" encoding= "GBK"?>
2 2<! DOCTYPE Struts Public
3 3 "-//apache Software foundation//dtd Struts Configuration 2.0//en"
4 4 "HTTP://STRUTS.APACHE.ORG/DTDS/STRUTS-2.0.DTD" >
5 5<struts>
6 6
7 7 <package name= "org" extends= "Struts-default" >
<action name= "Login" class= org. Loginaction ">
<result name= "Input" >/login.jsp</result>
1010 <result name= "Error" >/error.jsp</result>
1111 <result name= "Success" >/welcome.jsp</result>
1212 </action>
1313 <action name= "getusers" class= org. Getusersaction ">
1414 <result name= "Login" >/login.jsp</result>
1515 <result name= "Success" >/listUsers.jsp</result>
1616 </action>
1717 </package>
1818</struts>
can be accessed through http://localhost:8080/strutsdemo/getUsers.action
2, 1<?xml version= "1.0" encoding= "GBK"
2<! DOCTYPE struts Public
3 "-//apache Software foundation//dtd struts Configuration 2.0//en"
4 "Http://struts.apa CHE.ORG/DTDS/STRUTS-2.0.DTD
5<struts>
6
7
8
9 <package name= "org" extends= Struts-default "
<action name=" login "class=" org. Loginaction ""
One <result name= "input" >/LOGIN.JSP</RESULT>
<result name= "error" >/er Ror.jsp</result>
<result name= "Success" >/welcome.jsp</result>
</ACTION>
15 </package>
<package name= "Get" extends= "Struts-default" namespace= "/apple"
<ac tion name= "getusers" class= org. Getusersaction "
<result name=" Login ">/login.jsp</result>
<result name=" Success "&G T;/listuser.jsp</result>
</action>
</package>
23</struts> can pass http:// Locahost:8080/strutsdemo/apple/getusers.action access to
Example 1 is a property that does not specify a namespace, the default namespace is empty, and Example 2 has namespace Apple.