<struts> <constant name="struts.devMode" value="true" /> <package name="user" extends="struts-default" namespace="/user"> //方法一 <action name="userAdd" class="com.struts2.user.action.UserAction" method="add"> <result>/user_add_success.jsp</result> </action> //方法二 <action name="user" class="com.struts2.user.action.UserAction"> <result>/user_add_success.jsp</result> </action> </package> </struts><span style="font-family: Arial, Helvetica, sans-serif;"> </span>
package com.bjsxt.struts2.user.action; import com.opensymphony.xwork2.ActionSupport; public class UserAction extends ActionSupport { public String add() { return SUCCESS; } }
调用方法:http://localhost:8080/Struts2_0500_ActionMethod//user/userAdd
【web开发学习笔记】Structs2 Action学习笔记(二),布布扣,bubuko.com
【web开发学习笔记】Structs2 Action学习笔记(二)
原文地址:http://blog.csdn.net/licong_carp/article/details/36886217