Solved

Manage session with jsp/servlet

Posted on 2001-09-17
7
705 Views
Last Modified: 2013-11-24
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 ?



0
Comment
Question by:kingasa
7 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 6487021
servlet API supports session management by default

read
javax.servlet.http.HttpSession documentation.
0
 

Expert Comment

by:sujatharathinam
ID: 6487062
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
0
 

Author Comment

by:kingasa
ID: 6487424
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..
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Accepted Solution

by:
andycandy earned 50 total points
ID: 6488895
hello kingasa!
HttpSession object instance is shared betwen every jsp pages and servlets wchich are requested by the same agent(browser I think) unless the user close the browser or session invalidate(the session timeout is specific for each servers, even for application and is configureable (see deployment descriptor or documentation for server and j2ee application)).
So,be sure you ommit the same parameter and its value from HttpSession object  on each jsp page and servlet.

If OrionServer is your server i can give you better approach.

Example
file://first.jsp
.
.
.
<%
 session.setAttribute("foo",new Integer(5));
%>
.

file://second.jsp
.
.
<%= session.getAttribute("foo")%>
...


you will see ..  5  .. instead of it


sorry for my english!

"8-) Andy


0
 

Author Comment

by:kingasa
ID: 6489535
when will I use url rewriting, cookies , etc..
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6490163
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.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6727897
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:

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

Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Eclipse IDE - Cannot copy/paste from console output 8 132
Problem to start Neon 20 88
java 8 lambda expresssions exception handling 3 75
GUI builder for Eclipse? 8 27
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now