问题Servlet action is not available
wcnmb 2007-05-24 12:02:50 点了登入就报错啊...
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = null;
String pwd = null;
if (form != null) {
id = ((LoginActionForm)form).getId();
pwd = ((LoginActionForm)form).getPwd();
}
HttpSession httpSession = request.getSession();
ActionForward actionForward = null;
List list = HibernateSessionFactory.execQuery("from Employee where id="+id);
List list2 = HibernateSessionFactory.execQuery("from Employee where pwd=" + pwd);
List list3 = HibernateSessionFactory.execQuery("from Employee where id=" + id + " and pwd=" + pwd);
if (list == null || list.size() == 0) {
ActionErrors errors = new ActionErrors();
errors.add("idfalse", new ActionMessage("errors.login.id.notvalid"));
this.saveErrors(request, errors);
actionForward = new ActionForward(mapping.getInput());
}
else if(list2 == null || list2.size() == 0)
{
ActionErrors errors = new ActionErrors();
errors.add("pwdfalse", new ActionMessage("errors.login.pwd.notvalid"));
this.saveErrors(request, errors);
actionForward = new ActionForward(mapping.getInput());
}
else {
httpSession.setAttribute("employee", (Employee)list3.get(0));
actionForward = mapping.findForward("success");
}
return actionForward;
}
}