How can I pass multiple user entries from one JSP to other JSP pages? Example I enter numbers 2, 3, 4, 5 in different input boxes and hit submit. I know that on the next page, the numbers will be there but on third one they will not.
Thank you!
How can I pass multiple user entries from one JSP to other JSP pages? Example I enter numbers 2, 3, 4, 5 in different input boxes and hit submit. I know that on the next page, the numbers will be there but on third one they will not.
Thank you!
once you key in details on first page and you want them to 2nd page you can use getparam(). If you want share the variable in multiple pages, you can use setAttribute()
Example :
<input type="text" name="name" value="">
<input type="text" age="age" value="">
String sNAME = request.getParameter("name");
String sAGE = request.getParameter("age");
session.setAttribute("SES_NAME",sNAME);
session.setAttribute("SES_AGE",sAGE);
String NAME = session.getAttribute("SES_NAME"));
String AGE = session.getAttribute("SES_AGE"));
A common approach is to put the values from the first page in to the second page as hidden fields. That way they will not be visible to the user, but will still be passed to your third page with the second form.
Depending on your use case you might not want to send the data back and forth like that, in which case you can store it in the session, or in your database.