Hi, I am trying to rretrieve a session value from a jsp page and cannot seem to do so correctly. What I am doinng is using a Model-View-Control process. I Have a dispatcher servlet which controls where the user goes on the web site. I pass in servlets to call and a jsp view page as values to the dispatcher servlet. When the user clicks on the url. It first of all calls the dispatcherservlet. Then it calls a createVisitId servlet and then redirects to the required jsp page. In the createVisitId servlet a visitId is set in session. When I redirect to the jsp page I retrieve my visitorId value from my session. This seems to work fine for the first jsp page I go to. However for all other jsp pages I then go to, I cannot seem to be able to access my visitorId from the session anymore. Does anyone know where my problem lies, and if so - how to solve it?
This may be a stupid question, but without seeing your code... Are you sure you are adding your object to the HttpSession and not the HttpServletRequest? Since your code only works for the first request, it sounds like maybe you are doing:
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Joined: Apr 25, 2002
It's funny Blake - but I found out afterwards that that is exactly what I was doing wrong. I have since fixed my problem. Cheers for the help.