Struts2的Action多方法调用
Action多方法调用
??? ??? 方式一:
??? ??? ??? 在struts.xml中的action标签中添加method值如:
??? ????
??? ??? ??? <!-- 没有method属性值则这是MyTestAction默认的调用方法即execute方法将被调用 -->
??? ??? ??? <action name="myTest" method="text1">
??? ??? ??? ??? <result name="success">/index.jsp</result>
??? ??? ??? </action>??? ????
??? ????
??? ??? 方式二:
??? ??? ??? 在struts.xml中的action标签不改
??? ??? ??? <action name="myTest" method={1}>
??? ??? ??? ??? <result name="success">/index.jsp</result>
??? ??? ??? </action>?? ??? ??? ??? ??? ????
??? ??? ??? 页面:
??? ??? ??? <a href="myTest.action">Action默认的方法</a><br>
??? ??? ? ??? <a href="myTest_text1.action">Action的text1方法</a><br>
??? ??? ? ??? <a href="myTest_text2.action">Action的text2方法</a>