Solved

JSP Sessions

Posted on 2002-04-17
9
273 Views
Last Modified: 2010-03-31
Hi,

I have been using scripting languages for a while now (ASP,PHP) and have only started learning JSP recently.

I was wondering what all the fuss was about using sessions, as it seems more prominent in all the JSP docs and tutorials.

What can be achieved using sessions that can't be my not using them? ie. what is the advantages and/or disadvantages?

I have seen some of the code, but have no idea how sessions work, and whether I should implement it in an upcoming project?

Also, some tuturial or doc for a beginner might help.

Next Project includes:

- User Login/verifying.
- Oracle 8i database connectivity.



Regards

Pierre
0
Comment
Question by:barnarp
9 Comments
 
LVL 5

Accepted Solution

by:
Jan Louwerens earned 50 total points
ID: 6949314
A session is an object that stays with a client the whole time they're on your site. You can store information in the session that is associated with a client.
For example, once a client logs in to your website, you can store the client's login name (or any info uniquely identifying the client: ID, email address, etc) inside the session and will stay with that client until you invalidate it from with your code, or the user closes the browser.
0
 

Expert Comment

by:jodear
ID: 6949821
jlouwere is right.

Aside from a session being able to stick with the client (that's why it is called session because it is the client's session with your server, he he he), its other advantages are:

1) storing data in a client's session cannot be seen by anyone compared to storing data in your html forms or in FAT URLs which can be seen when your view source from the browser or blatantly shown in your browsers Address bar.

2) you can store an unlimited amount of data in the client's session object (limited of course by the server's hardware) unlike using FAT URLs which usually can contain less than 500 chars.

Definitely you'd want to use sessions for checking login data of your clients.  Any sensitive or large-size data you want stored or connected to your client's "session" with your server should be stored in sessions.
0
 
LVL 5

Expert Comment

by:Jan Louwerens
ID: 6951266
If you have a large amount if clients, thought, storing large amounts of data n the sesion could result in storage (memory) problems, which in turn could affect site performance. For really large abounts of data, you'd want to store it in a database, or something similiar, and retrieve it upon demand.
And GET URLs are limited to 256 chars (as iodear states), so you can't store much there.
0
 

Author Comment

by:barnarp
ID: 6951580
Thanks.

Atleast I now have a starting point!

Regards

Pierre
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:barnarp
ID: 6951581
Thanks.

Atleast I now have a starting point!

Regards

Pierre
0
 
LVL 1

Expert Comment

by:Jan Louwerens
ID: 6951692
barnarp, I noticed there was a problem with the answer (there is still a Proposed Answer, and no real Accepted Answer, although it shows there should be one).
Could you describe to me exactly what happened, from your user perspective, that might have caused that to happen?
Did anything go wrong while accepting the answer? Where you logged out by the system? Any information you provide could help to prevent this from occuring in the future.
Thank you.
0
 

Author Comment

by:barnarp
ID: 6958920
sorry,

didn't really notice. I did however think I accept the comment as an answer, but later found out that I just posted a normal comment. I then accepted the answer a second time.

Pierre
0
 
LVL 35

Expert Comment

by:girionis
ID: 8682523
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to jlouwere

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 46
PDFBox - convert image to PDF, PDF resolution 3 118
thymeleaf natural templating vs JSP 2 68
tomcat not starting 6 31
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 video teaches viewers about errors in exception handling.

895 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

18 Experts available now in Live!

Get 1:1 Help Now