This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have two html pages and I have the submit button in second page. I have to save the data of the first page when the user navigates to the second one. This can be done using Session tracking. What I know is u can start of saying HttpSession ses = request.getSession(true); I am not sure how I will save the value in the fields of the first form. Should I create String variables to save the data. If that is the case I need not create a session object. What I will do is I will place a button called "continue" in my first html and check. If it is equal to "continue" I will save it in String variables and if it is "submit" then I will try to do the reqd manipulation.
I am really sought of breaking my head about how to use session object to save my data in first page. can anyone help me with a example code. Just give me an example using two fields in first page and two fields along with submit button in second page. Please... I need ur help.
A simple approach - assuming your servlet or JSP writes the second page, is to just re-write those first page form values into the second page form as type="hidden" variables, that way when you process the second page all variables will be there. Your servlet can tell if it is getting a response from the first or second page with the same technique. <input type="hidden" name="page" value="first" > Sessions would also work but this is simpler and works no matter how the browser is set up. WBB