Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Quickguide Tomcat Login form

Related Tutorials


 
 

Share on Google+Share on Google+

Login form

Advertisement
Now for your confidence with JSP syntax, following example of login form will really help to understand jsp page.

Login Form with jsp

     

Now for your confidence with  JSP syntax, following example of login form will really help to understand jsp page. In this  example we will create a simple dynamic JSP page that prints the user information into next page.

With the help of this example we are going to show- how to display a logged-in information on to the browser. 

In this example it is very easy to display it on our browser with the help of java.util package. In this example we are going to insert the data in the login form which will be displayed onto the next page. 

This jsp program works with html tags in which there are two fields one is for name and the other one is for entering  password and there is a submit button, that works on clicking. 

The code the program is given below:

<html>
<head>
<title>Enter your name and password</title>
</head>
<body bgcolor="#999966">
<p>&nbsp;</p>
<form method="POST" action="loginaction.jsp">
<p><font color="#800000" size="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Enter your name:</font><input type="text" name="username" size="20"></p>
<p><font color="#800000" size="5">
Enter your password:</font><input type="text" name="password" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>

Here is the code of "loginaction.jsp" file:

<%@page contentType="text/html" %>
<html>
<body bgcolor="#999966">
<p><font size="6">Welcome :&nbsp; 
<%=request.getParameter("username")%></font></p>
</body>
</html>

The output of the program is given below:

This is the output of the above input:

Download Source Code

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 8, 2008

Related Tutorials

Discuss: Login form   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:10
hansraj
March 11, 2011
jsp source code

need jsp source code
chaitanya
May 26, 2011
in registration page .

name,address,mobile,edu.qualification,morethan chekboxes how to get the code
sanam
May 30, 2011
thanks

its useful
thenmozhi
August 16, 2011
jsp

i need to know which the authorized book for jsp
Murugesan
September 12, 2011
Page

Nice Lesson, little bit interesting
ravi
January 13, 2012
java programming

nice information, it is very nice to see in google first page
Konza
March 20, 2012
Not correct

Where did you activate the session in this example?
nikita
April 4, 2012
database

how to create database in jsp
Sanjay Kumar
June 13, 2012
"APPRECIATE FOR JAVA PROGRAM"

I AM SANJAY KUMAR COMPLETED MCA FROM BUNDELKHAND UNIVERSITY JHANSI UP . I AM ALSO SUN CERTIFIED FOR JAVA PROGRAMMER FOR JDK1.6 PLATFORM. I AM VERY...VERY HAPPY FOR YOUR TUTORIAL AND I FEEL GOOD SATISFACTION. THANKS&REGARDS SANJAY KUMAR JEHANABAD BIHAR
reema
May 27, 2014
doubt

how to run login.jsp and login action.jsp together??
DMCA.com