|  Home   |  Contact Us   |  Online Exam   |  Tech World   |  Jobs    |  Member Login
Java Interview Questions
Jdbc Interview Questions
Servlet Interview Questions
Jsp Interview Questions
Struts Interview Questions
Ajax Interview Questions
Webservice Interview Questions
Designpattern Interview Questions
J2me Interview Questions
EJB Interview Questions
Spring Interview Questions
Hibernet Interview Questions
Enterprise IT Training
Java Program Examples
Ask Technical Expert!
Write Online Exam and Get Job Opportunity Here!
        JSP Examples          
Steps to Execute Jsp  |   Module 1  |   Module 2  |   Module 3  |  

JSP: Working with sessions
Step 1:Here the code(seslogin.jsp) is that takes the input from user
      <%@ page language="java" %>
      <html>
     <head>
     <title>Name Input Form</title>
     </head>
     <body>
     <form method="post" action="sesrequest.jsp">
     <center>
     <b>Enter Your Name: </b><input type="Password" name="Password"><br>
     <input type="submit" value="Submit">
     </center>
     </form>
     </body>
     </html>

Step 2:Here the code(sesrequest.jsp) is incoming request is stored in session
     <%@ page language="java" %>
     <%
     String Password=request.getParameter("Password");
     if(Password==null) Password="";
     session.setAttribute("Password",Password);
     %>
     <html>
     <head>
     <title>Your Password is Saved</title>
     </head>
     <body>
     <p><a href="sesview.jsp">Go To Next Page</a><p>
     </body>
     </html>
Step 3:Here the code(sesview.jsp) is linkpage is show Password to User
     <%@ page language="java"      %>
     <%
     String Password=(String) session.getAttribute("Password");
     if(Password==null) Password="";
     %>
     <html>
     <head>
     <title>Show Saved Password</title>
     </head>
     <body>
     <center><font color=#8B008B size="4">Hai Welcome To Your Password is:</font>
     <font color=#800000 size="5"><%=Password%></font></center>
     </body>
     </html>
Back to Top
All Rights Reserved : skdotcom technologies