Saturday, 21 April 2012

Login Form with Java Script

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="grey">

<form method="POST" action="loginaction.jsp">

<font color="brown" size="5">

Username:
</font>
<input type="text" name="username" size="20"></p>

<font color="brown" size="5">
Password:
</font>
<input type="text" name="password" size="20">
<input type="submit" value="Submit" name="B1">
</p>Design by:- Param
</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:

  
For any answers post your questions from ur mind..........

No comments:

Comments System