login using jsp , the login is based on session object ,here there are three files: login(Sign-in) form, check sign-in ,and logout , You can change the check of login to your program needs .here the files i made .
1 .The Main Page . contain login form html code
<HTML> <HEAD> <TITLE>Login using jsp</TITLE> </HEAD>
// Here you put the check on the username and password if (username.toLowerCase().trim().equals("admin") && password.toLowerCase().trim().equals("admin")) { out.println("Welcome " + username + " <a href=\"index.jsp\">Back to main</a>"); session.setAttribute("username", username); } else { out.println("Invalid username and password"); }
Hi, In your program,there is a bug.That is if you click the logout link,it'll take you to the index page but after that if you click the back button,it'll again take you the welcome page .Please check it....
Hi, In your program,there is a bug.That is if you click the logout link,it'll take you to the index page but after that if you click the back button,it'll again take you the welcome page .Please check it....
hi every one this is the best solution to the logout problem which logs out user when logout link is clicked,it also solves the problem of url, copying and pasting the url does not open the page after logout
this example consists of a sample.html page which takes name and password as input. Please enter name as kiran and password as kiran it then forwards to a login.jsp and if name and password are correct it sends it to a welcome.jsp page which has some links like x.jsp,y.jsp,z.jsp and p.jsp and a logout link. the codes are shown below and are as follows:
**sample.html**
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT"> <title>SOLVING LOGOUT PROBLEM EFFICIENTLY USING JSP</title> </head>
hi i want to check it from the database please any one help me
make class for connection then write the name of the next page in form tag example <form action="pagename.jsp"> in the second page we import the class file which make the connection and retrieving data from the database and check the username/password example <%@page import="Exam.Validation" %> <jsp:useBean class="Exam.Validation" id="vl" scope="session"></jsp:useBean> then we take the user name and password form the varriable name of textbox form fist page and pass to the validation class example <% String s=request.getParameter("Ut"); %> <% String p=request.getParameter("Pt"); %> and wirte the syntax if u/p wrong to forward the page example <% if (!vl.validation(s, p ))response.sendRedirect("index.jsp?msg= invalid user Name/password"); %>