struts跳转不到error页面
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
UserForm userForm = (UserForm) form;
Manage m = new Manage();
Userbean b = null;
HttpSession session = request.getSession();
b = m.check(userForm.getUsername(), userForm.getPassword());
if (b!=null) {
b.setMessage((Constants.title_first));
session.setAttribute("user", b);
return mapping.findForward("mainhome");
} else {
return mapping.findForward("error");
}
}
以上是action中的代码
经过debug确定b确实为null
可是仍然进入if (b!=null)的语句中跳转到mainhome中
却跳转不到error中
请高手指点