调用struts2 action 的几种

来源:互联网 发布:能用网络发短信吗 编辑:程序博客网 时间:2024/05/18 01:44

1  动态调用action     使用的是!

如:

http://localhost:8080/struts2Test/login!login

struts2Test   项目路径

login    action名称

login  是 action的方法名


2 . 使用通配符配置

请求是:

http://localhost:8080/struts2Test/login_login

struts.xml  配置如下

    <action name="login_*" class="com.action.LoginAction1"  method =“{1}”>
          <result name="success">/success.jsp</result>
          <result name="fail">/index.jsp</result>
       </action>

3.常用请求配置

http://localhost:8080/struts2Test/login

struts.xml

   <action name="login*" class="com.action.LoginAction1"  method =“login”>
          <result name="success">/success.jsp</result>
          <result name="fail">/index.jsp</result>
       </action>


0 0
原创粉丝点击