日期:2014-05-19  浏览次数:20609 次

在struts1中,一个action里能有多个ActionForward吗?
如题,我现在想在loginAction.java中写多个ActionForward,不知道可以吗?如果可以在是不是使用method?前台jsp页面是这样写?action="custAction.do?method=add"
Java code

public class loginAction extends Action{
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        // Unknown testAction = (Unknown) form;// TODO Auto-generated method
        // stub
        testService testserv = new testService();
        String username = request.getParameter("user_name");
        String password = request.getParameter("user_password");
        boolean result = testserv.loginUser(username, password);
        if (result){
            return mapping.findForward("suess");
        }else{
            
            return mapping.findForward("fail");
        }
}
}



------解决方案--------------------
继承DispatchAction
------解决方案--------------------
错啦 是加这个 parameter="method"