Solved

JSP Sessions

Posted on 2002-04-17
9
272 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:barnarp
ID: 6951581
Thanks.

Atleast I now have a starting point!

Regards

Pierre
0
 
LVL 1

Expert Comment

by:jansuper
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bunnyEars challenge 6 65
How Complex Is This Java Course ? 9 63
json format text only 4 65
Python Assistance 7 36
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

760 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

20 Experts available now in Live!

Get 1:1 Help Now