rorymurray
Programmer
I am using a servlet to process information from an online survey.
Basically the servlet receives parameters from different pages.
With each page it stores the parameter values as session attributes, then forwards to the next page, which in turn posts more parameter values, the servlet stores them as session attributes and so on. Example below:
---//data from page 2---
session.setAttribute("two_1", request.getParameter("two_1");
---//forward to next page
RequestDispatcher rd = getServletContext().getRequestDispatcher(request.getParameter("next_page");
rd.forward(request,response);
Now this works fine while you are trying to access the attributes while still in the current page, but if, say you have stored page 2's attributes and then you process page 3's, when you want to refer to the value of page 2's they return null.
I have checked the session id to make sure it is the same but it appears as though it is the same session.
Any ideas? (Let me know if you want the full servlet code).
Thanks
Rory
P.S. I know I could just insert these values into the database as the data from each page comes in, but it will slow down performance with the number of database accesses required.
Basically the servlet receives parameters from different pages.
With each page it stores the parameter values as session attributes, then forwards to the next page, which in turn posts more parameter values, the servlet stores them as session attributes and so on. Example below:
---//data from page 2---
session.setAttribute("two_1", request.getParameter("two_1");
---//forward to next page
RequestDispatcher rd = getServletContext().getRequestDispatcher(request.getParameter("next_page");
rd.forward(request,response);
Now this works fine while you are trying to access the attributes while still in the current page, but if, say you have stored page 2's attributes and then you process page 3's, when you want to refer to the value of page 2's they return null.
I have checked the session id to make sure it is the same but it appears as though it is the same session.
Any ideas? (Let me know if you want the full servlet code).
Thanks
Rory
P.S. I know I could just insert these values into the database as the data from each page comes in, but it will slow down performance with the number of database accesses required.