不继承Action 而继承LookupDispaction
根据Map的值来掉用使用那个事件:(期间还有怎样传值)
页面关键代码:
属性文件代码:
sucess=sucess
error=error
Action中的关键代码:
public ActionForward sucess(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
ForwardActionForm forwardActionForm = (ForwardActionForm) form;
System.out.println("传过来的name值为:" + request.getParameter("name"));
return mapping.findForward("sucess");
}
public ActionForward error(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
ForwardActionForm forwardActionForm = (ForwardActionForm) form;
System.out.println("传过来的name值为:" + request.getParameter("name"));
return mapping.findForward("error");
}
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("error", "error");
map.put("sucess", "sucess");
return map;
}
阅读(857) | 评论(0) | 转发(0) |