struts2使用注解--ACTION中的应用
原文出处:http://blog.sina.com.cn/s/blog_4f9ce8f30100xq0l.html
1.在类中指定包
@ParentPackage("system")。其中system是在struts.xml中定义的包名。
2.配置文件--->注解
2.1配置文件方式(返回json)
<action name="loadUserTree" class="userAction" method="loadUserTree">
<result type="json"><param name="root">userLists</param></result>
</action>
2.2注解方式(返回json)
@Action(value="loadUserTree",
params={"root","userLists"})
2.3配置文件方式
<action name="getMobileCode" class="usefulToolsAction" method="getMobileCode">
<result name="success">/main/tool/MobileCode.jsp</result>
</action>
2.4注解方式
@Action(value="getMobileCode", ```java