学会了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>