?
Solved

Manage session with jsp/servlet

Posted on 2001-09-17
7
Medium Priority
?
713 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

 

Accepted Solution

by:
andycandy earned 150 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 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