I have 2 jsp pages with forms and in first jsp page, once the user fill the form then they will click on 'continue' button and in the second page they have to enter data for few more form fields and do submit. once they do submit then data from 1st jsp and 2nd jsp need to be updated to backend. My question how i can submit the form in second page with first page data included
Asked
Active
Viewed 92 times
0
-
Need JSP only solution as I am not using any frameworks or servlets – uidev Apr 28 '16 at 16:55
-
try to store values in a request object in the 1st JSP , then do the same thing when you move to the 2nd JSP , and programm aliitle block that will get all parameters stored in the request Object and send them to the DataBase – PacMan Apr 28 '16 at 19:03
-
yes, doing same.. thanks for response – uidev Apr 28 '16 at 20:32
-
if you have any doubt on it you can share your code , and we are here for help – PacMan Apr 28 '16 at 20:55
-
Hi, I like to know how i can get the file name of uploaded file within jsp. I used request.getParameter("filename") but its returning null. please let me know – uidev May 04 '16 at 03:50
-
try to have a look on this http://stackoverflow.com/questions/37015292/how-to-get-uploaded-file-within-jsp-scriptlet – PacMan May 04 '16 at 11:11
1 Answers
0
Store the user input from the first form in <input type="hidden">
in the second form. If there are are file inputs, then you'll need to store the file on the server and include some kind of reference (like a unique id or a URL) in the input.
Alternatively, you could use a session (but that risks a race condition if the user fills in two copies of the form at the same time across multiple tabs in their browser).
Alternatively, you could store the data in its final destination (e.g. a database table) with a flag on it marking it as a draft. Then update it with the rest of the data and remove the flag when the second form is submitted.

Quentin
- 914,110
- 126
- 1,211
- 1,335