Link to home
Start Free TrialLog in
Avatar of kingasa
kingasa

asked on

Manage session with jsp/servlet

Hi,

I have an intranet web application which is based on java servlet & jsp.
What is the best way to manage a user session ? & how ?



Avatar of heyhey_
heyhey_

servlet API supports session management by default

read
javax.servlet.http.HttpSession documentation.
In jsp just write
<%
request.getSession(true);
session.putValue("name",suja)
%>
while trying to get the session value..
just write
<%!
String name1;
%>
<%
name1 = (String)session.getValue("name");
%>
You can also store a array in a session.
In Servlets just instantiate HttpSession and then try to use the same code.
All The Best
Avatar of kingasa

ASKER

Just posted this Q please allow other pepole to comment.

How do I get the parameters values entered in one jsp from another jsp.

when will I use any of the technologies available,
url rewriting, cookies , etc..
ASKER CERTIFIED SOLUTION
Avatar of andycandy
andycandy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kingasa

ASKER

when will I use url rewriting, cookies , etc..
it seems that this question is quite attractive :)

most servlet engines have some configuration files that allow you to specify if you want to use cookies or URL rewriting - servlet engine handles all the low level stuff.
This question is LOCKED with a Proposed Answer.  If it helps you, great, accept it and grade it to close.  If not, reject it and comment as to why or what else is needed.

Few additional experts will join this collaboration effort, once a question has been locked.  Just want to confirm this to you.  If more than one expert helps you, you can always split points or award additional help in a new question, within the same topic area.  If you need help from us, post a zero point question here, and include the link:

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

Moondancer
Community Support Moderator @ Experts Exchange