A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Save session inside a Servlet
Joined: Jun 22, 2012
Sep 18, 2012 05:43:43
Hi I want save in session values in my
because, when I redirect to my page with
RequestDispatcher dispatcher = request .getRequestDispatcher("/index.jsp"); dispatcher.forward(request, response);
I the values are no displayed.
Could I set the values I get from processing my Servlet and display them direclty?
Joined: Aug 11, 2012
Sep 18, 2012 05:59:05
Angus Ferguson wrote:
the values are no displayed.
Could you explain more clearly what values are you trying to display and where??
How you are passing it?? And how till now are you storing it in session (if so)..
Author and ninkuma
Joined: Jan 10, 2002
Sep 18, 2012 08:31:25
The session is not necessary during a forward. Request scope is a better choice.
Asking smart questions
Books by Bear
Joined: May 15, 2011
Sep 28, 2012 04:07:18
This is how you set attribute to request and session. You have to set it before you forward your request to jsp.
request.setAttribute("name", value); session.setAttribute("name", value);
Make sure that you understand the differences between session and request scope before choosing one.
And as R.Jain already mentioned, we need more information on what you are trying to do and how's your current situation.
A web application developer wannabe from Thailand
My StartUp :
I agree. Here's the link:
subject: Save session inside a Servlet
My servlet Notes
session in netscape 4.7
accessing session variables when we use sendRedirect
how to use uploaded file
Problems with servlet filter
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013