狂晕!登录问题
gzf30 2004-10-23 10:24:05 在index.jsp里面加了下面代码,不加时登录验证OK,加了以后应该转到index.jsp的也转到error.jsp
<%
if(session.getAttribute("inforagentLogin")==null){
response.sendRedirect("error.jsp");
}
%>
验证登录页面checkagent.jsp代码
<title>checkagent</title>
</head>
<body>
<%
String agentLogin;
String agentPasswd;
dbAgents agent=new dbAgents();
agentLogin = request.getParameter("agentLogin");
agentPasswd = request.getParameter("agentPasswd");
session.setAttribute("inforloginName",agentLogin);
session.setAttribute("inforagentPasswd",agentPasswd);
if(agentLogin==null||agentLogin.length() == 0 ||agentPasswd==null||agentPasswd.length()== 0){
response.sendRedirect("error.jsp");
}
else if(agent.lookup(agentLogin) && agentPasswd.equals(agent.getPasswd())){
response.sendRedirect("index.jsp");
}
else{
response.sendRedirect("error.jsp");
}
%>
</body>
</html>