Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sessions in jsp
12-19-2011, 11:26 PM
Post: #1
Smile sessions in jsp
In Jsp,creating sessions is an important task for any webpages.
By using sessions you will maintain the users status until he logged out.
First lets creating a session for a name.create a html page
index.html

Quote:<html>
<body>
<form action="set.jsp" method="get">
<input type="text" name="name">
<input type="submit" value="submit"/>
</form>
</body>
</html>

set.jsp
<%
String name=request.getParameter("name");
session.setAttribute("name",name);
response.sendRedirect("get.jsp");
%>
get.jsp
Welcome
<%=session.getAttribute("name") %>
Now you are creating session successfully lets try this in more no of page you can.
For invalidating the session use
session.invalidate();
Any doubt do ask us bye bye
Find all posts by this user
Add Thank You Quote this message in a reply
01-12-2012, 09:55 PM (This post was last modified: 01-13-2012 01:02 AM by mjm.)
Post: #2
RE: sessions in jsp
Thanks for the code
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Exclamation sessions in jsp-part2 rajasri 0 85 12-13-2011 04:49 AM
Last Post: rajasri

Forum Jump:


User(s) browsing this thread: 1 Guest(s)


WE will share important jobs and updates on facebook so like us to get updates