首页上一页 1 下一页尾页 3 条记录 1/1页
求教
发表在JavaWeb图书答疑
2007-12-26
是否精华
是
否
版块置顶:
是
否
我在MYECLIPSE里调试《JAVA数据库系统开发案例精选》中图书管理系统的时候,把strut-config里这样配置<action
attribute="managerForm"
name="managerForm"
path="/manager"
scope="request"
type="com.action.ManagerAction">
<forward name="managerLoginok" path="/main.jsp" />
<forward name="error" path="/error.jsp" />
</action>
manageraction里这样配置private ManagerDAO managerDAO=null;
public ManagerAction(){
this.managerDAO=new ManagerDAO();
}
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
String action=request.getParameter("action");
if(action==null||"".equals(action)){
return mapping.findForward("error");
}else if("login".equals("action")){
return managerLogin(mapping,form,request,response);
}
request.setAttribute("error","操作失败!");
return mapping.findForward("error");
}
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward managerLogin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
ManagerForm managerForm = (ManagerForm) form;
managerForm.setName(managerForm.getName());
managerForm.setPwd(managerForm.getPwd());
int ret = managerDAO.checkManager(managerForm);
if(ret==1){
HttpSession session=request.getSession();
session.setAttribute("manager",managerForm.getName());
return mapping.findForward("managerLoginok");
}
else{
request.setAttribute("error","您输入的管理员名称或密码错误!");
return mapping.findForward("error");
}
}。
可是进入login界面无论密码用户名是否正确输入都智能跳转到http://127.0.0.1/equipment/manager.do?action=login界面,而不能跳转到所指的main.jsp或者error.jsp界面,请教!!
attribute="managerForm"
name="managerForm"
path="/manager"
scope="request"
type="com.action.ManagerAction">
<forward name="managerLoginok" path="/main.jsp" />
<forward name="error" path="/error.jsp" />
</action>
manageraction里这样配置private ManagerDAO managerDAO=null;
public ManagerAction(){
this.managerDAO=new ManagerDAO();
}
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
String action=request.getParameter("action");
if(action==null||"".equals(action)){
return mapping.findForward("error");
}else if("login".equals("action")){
return managerLogin(mapping,form,request,response);
}
request.setAttribute("error","操作失败!");
return mapping.findForward("error");
}
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward managerLogin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
ManagerForm managerForm = (ManagerForm) form;
managerForm.setName(managerForm.getName());
managerForm.setPwd(managerForm.getPwd());
int ret = managerDAO.checkManager(managerForm);
if(ret==1){
HttpSession session=request.getSession();
session.setAttribute("manager",managerForm.getName());
return mapping.findForward("managerLoginok");
}
else{
request.setAttribute("error","您输入的管理员名称或密码错误!");
return mapping.findForward("error");
}
}。
可是进入login界面无论密码用户名是否正确输入都智能跳转到http://127.0.0.1/equipment/manager.do?action=login界面,而不能跳转到所指的main.jsp或者error.jsp界面,请教!!