struts1怎样由action跳到action的问题

来源:互联网 发布:gnuradio livecd linux 编辑:程序博客网 时间:2024/05/09 18:47

学回了struts2回过头来学struts1

有关action跳转的问题

EmployeeInfoAction类

 /**
  * 加载全部的方法
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  */
 public ActionForward loadList(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) {
  
  EmployeeInfoForm employeeInfoForm = (EmployeeInfoForm) form;// TODO Auto-generated method stub
  List<EmployeeInfo> employeeInfoList =  this.employeeInfoServiceImpl.getAllEmployeeInfo();
  //保存对象变量
  request.setAttribute("employeeInfoList", employeeInfoList);
  return mapping.findForward("success");
 }
 /**
  * 执行删除的方法
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  */
 public ActionForward delete(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) {
  
  EmployeeInfoForm employeeInfoForm = (EmployeeInfoForm) form;// TODO Auto-generated method stub
  boolean result =this.employeeInfoServiceImpl.deleteEmployeeInfo(employeeInfoForm.getEmployeeInfo());
  //重定向到action
  return new ActionForward("/employeeInfo.do?employee=loadList");
 }

 

实现的业务是:当用户删除一个数据的时候跳转到显示全部信息的页面

 

struts-config.xml

 <action-mappings >
    <action
      attribute="employeeInfoForm"
      name="employeeInfoForm"
      path="/employeeInfo"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy"
      cancellable="true"
  parameter="employee">
      <forward name="success" path="/index.jsp" />
      <forward name="search" path="/search.jsp" />
    
    </action>


  </action-mappings>

原创粉丝点击