aspose file tools*
The moose likes Servlets and the fly likes what should i use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "what should i use " Watch "what should i use " New topic
Author

what should i use

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Hi to all
one more silly question..

Hey here i am developing one webapplicaion like student registration create ,delete modify,search ...
and i am using MVC2 architecture ...
so my doubt is while sending the values from servlet to jsp i am using sessions..
am i right?
or what shouyld i need to use..
i think there are 4 types request,application,session,

please will give me real time implementation for this

please answer me...soooon

thanx in advance
cinux


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

No, you shouldn't be using the session to pass data from the Servlet to the JSP for display. You can keep the data in the 'request scope' by using request.setAttribute(...) and then use request.getAttribute(...) in the JSP, since they share the same request.
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
Though you can use sessions but in case the the values are not being used through out the session don't use them. In your case it seems that you only require them to be passed amongst the requests. So I would recommend you to use the request scope for your application.
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
but what happens if i use session..
will there be any performance edgradation??
thanx a lot
cinux
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
Originally posted by saikrishna cinux:
but what happens if i use session..
will there be any performance edgradation??
thanx a lot
cinux


Do not use session if you do not required. It will degrade the performance. You can share data between servlets and jsps using request object get and set parameter methods and store your data in JavaBeans.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

but what happens if i use session..
will there be any performance edgradation??


Where do you think session objects live?

They stay in main memory once created and live happily for atleast 30 minutes. So think twice before prefering session scope.
[ February 24, 2006: Message edited by: Vishnu Prakash ]

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Use the best qualified scope for that particular work.

Originally posted by Vishnu Prakash:
They stay in main memory once created and live happily for atleast 30 minutes. So think twice before prefering session scope.


Are you serious about 30 mins? I mean, it depends.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

I mean, it depends.


Yes, you are correct, that depends. What I said was with respect to Tomcat implementation.
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
Originally posted by Vishnu Prakash:


Yes, you are correct, that depends. What I said was with respect to Tomcat implementation.


I guess even with respect to Tomcat it is not fixed. We can change the session time.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

I guess even with respect to Tomcat it is not fixed. We can change the session time.


We were talking about default time.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Its 60 mins, I guess. Isn't it? Doesn't matter. Whatever.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

Its 60 mins, I guess. Isn't it?


Na. It is 30 minutes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what should i use