Struts02访问通配符

来源:互联网 发布:武林外传多玩数据库 编辑:程序博客网 时间:2024/06/06 04:47

使用通配符前:

<action name="hello" class="cn.lfsenior.Hello.HelloStruts2" method="login">      <result name="login">/success.jsp</result>  </action>     <action name="hello" class="cn.lfsenior.Hello.HelloStruts2" method="register">      <result name="register">/register.jsp</result>  </action>  

使用通配符后:

<!-- http://localhost:8080/struts02/user_login -->//星号表示的就是login  <action name="user_*" class="cn.itcast.a_config.UserAction" method="{1}">  <result name="{1}">/{1}.jsp</result>  </action>  

使用通配符可以简化代码,使其变得更加灵活

当有两个*时,后面需要用{1},{2}分别来表示*

原创粉丝点击