DispathAction

1、如果复写DispatchAction中的execute方法,必须采用super调用execute方法
2、parameter参数值不能是execute或perform

<action path="/user/usermaint"
       type="com.bjsxt.drp.web.usermgr.actions.UserAction"
       name="userForm"
       scope="request"
       parameter="command" 
     >
      <forward name="add_success" path="/user/usermaint.do" redirect="true"/>
      <forward name="del_success" path="/user/usermaint.do" redirect="true"/>
      <forward name="find_success" path="/user/user_modify.jsp"/>
      <forward name="list_success" path="/user/user_list.jsp"/>
      <forward name="modify_success" path="/user/usermaint.do" redirect="true"/>
     </action>
3、必须在<action>标签中定义parameter属性
4、了解DispatchAction中unspecified方法的含义
 
 protected ActionForward unspecified(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  System.out.println("UserAction.unspecified()");
  //调用业务逻辑操作
  List userList = UserManager.getInstance().findAllUserList();
  request.setAttribute("userlist", userList);
  return mapping.findForward("list_success");
  
 } 

模式匹配(约定优于配置)

  <action path="/*"
    type="com.bjsxt.struts.UserAction"
    parameter="command"
   >
   <forward name="success" path="/{1}_success.jsp"/>
  </action>

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