DMI动态方法调用 和 通配符

动态方法调用DMI

 

http://localhost:8080/Struts2/user!add

 

 

<action name="user" class="com.action.UserAction">

         <result>/user_add_success.jsp</result>

</action>

 

public class UserAction extends ActionSupport {

        public String add()  {

               return SUCCESS;

       }

}

 

 

通配符

 

约定优于配置

<action name="Student" class="com.struts.action.StudentAction" method="{1}">

         <result>/Student{1}_success.jsp</result>

</action>

 

<action name="*_*" class="com.struts.action.{1}Action" method="{2}">

        <result>/{1}_{2}_success.jsp</result>

</action>

 

你可能感兴趣的:(jsp,struts)