Joined: Tue Mar 27, 2007 10:55 pm Posts: 2279 Location: Earth Has thanked: 39 time Have thanks: 61 time
login using jsp , the login is based on session object ,here there are three files ,login form ,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
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"); }
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
violetlaura
Code subject: Re: login using jsp
Posted: Wed Mar 25, 2009 5:33 am
Joined: Tue Mar 24, 2009 3:49 am Posts: 1 Has thanked: 0 time Have thanks: 0 time
I love this~~~~~~~ Thank you.
krrish
Code subject: Re: login using jsp
Posted: Tue Jan 25, 2011 2:34 pm
Joined: Tue Jan 25, 2011 2:21 pm Posts: 1 Has thanked: 0 time Have thanks: 0 time
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....
goldendraco
Code subject: Re: login using jsp
Posted: Thu Jun 30, 2011 1:29 pm
Joined: Thu Jun 30, 2011 1:23 pm Posts: 1 Has thanked: 0 time Have thanks: 0 time
love it thanks
hanamant
Code subject: Re: login using jsp
Posted: Tue Jul 26, 2011 7:21 am
Really good one love it....................
mahes
Code subject: Re: login using jsp
Posted: Fri Oct 07, 2011 7:01 am
hi i want to check it from the database please any one help me
Guest
Code subject: Re: login using jsp
Posted: Sat Nov 05, 2011 9:50 am
krrish wrote:
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>
for any queries contact me at jaikiran.anits@gmail.com or jaikiran_cool@yahoo.com
Habbakuk
Code subject: Re: login using jsp
Posted: Mon Nov 07, 2011 7:21 am
Joined: Mon Nov 07, 2011 7:07 am Posts: 1 Has thanked: 0 time Have thanks: 0 time
Guest wrote:
Thats it hope it solves the logout problem
for any queries contact me at jaikiran.anits@gmail.com or jaikiran_cool@yahoo.com
There is still a problem, it did not work for me.
Guest
Code subject: Re: login using jsp
Posted: Mon Jan 02, 2012 2:16 pm
mahes wrote:
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"); %>
drkelly
Code subject: Re: login using jsp
Posted: Sun Jan 15, 2012 7:41 am
Joined: Sun Jan 15, 2012 7:38 am Posts: 1 Has thanked: 0 time Have thanks: 0 time
thanks..it worked for me. Very appreciated of all your help. Great forum.