0
Привет Я делаю небольшое приложение для входа с помощью servlet
, мой ответ я перенаправлении другой jsp
но его перенаправляют, Ниже мой кодстраница не существует перенаправление в сервлет
PreparedStatement ps = con.prepareStatement("select * from sahi_users where username = ? and password = ?");
ps.setString(1, request.getParameter("userName"));
ps.setString(2, request.getParameter("pass"));
ResultSet rs = ps.executeQuery();
while (rs.next()) {
check = true;
}
if(check){
HttpSession session = request.getSession();
session.setAttribute("user", request.getParameter("userName"));
//setting session to expiry in 30 mins
session.setMaxInactiveInterval(30*60);
Cookie userName = new Cookie("user", request.getParameter("userName"));
userName.setMaxAge(30*60);
response.addCookie(userName);
response.sendRedirect("./Login.jsp");
}else{
RequestDispatcher rd = getServletContext().getRequestDispatcher("/Login.jsp");
PrintWriter out= response.getWriter();
//out.println("<font color=red>Either user name or password is wrong.</font>");
rd.include(request, response);
}
Спасибо заранее, Suganth.
если я данного точное имя пользователя и пароль, и его не адресности перенаправлены? – Suganth
, когда вы укажете правильное имя пользователя и пароль. видите ли вы изменение в URL? –
Привет, Гаутам, нет URL-адреса не изменяется – Suganth