There are several ways to transfer information from one JSP page to another.
1. Hidden values.
Just write the data in the input field in the form with the type "hidden", for example.
<input type="hidden" name="mydata" value="<%=thedata%>">
Data recorded in this way will be sent back when the appropriate form is submitted. This can be a useful way to “transfer” information as the user fills out a series of dialogs, since all states are user-defined, and the back and forward buttons work as expected.
2. Record URL.
Attach the parameters to the URLs in the links on the page, for example
<a href="another.jsp?mydata=<%=thedata>>Go!</a>
It also maintains state with the client, eliminating the need to submit a form element.
3. Cookies.
Must speak for itself. The state is still user-defined, but it is now processing a cookie. More fragile in some way, as some people disable cookies. In addition, the back and forward buttons can do unexpected things if you are not careful.
4. Server side (session)
Finally, you can store data in a session variable on one JSP and retrieve it on the next, for example.
session.setAttribute(String key, Object value)
and
session.getAttribute(String key)
Here, the state is maintained on the server side, which has some advantages (the user can browse and return without losing space, but tends to make the back and forth buttons in the browser a little unreliable if you are not careful. Is available for all pages.
However, it has the advantage that information is never sent to the client and, therefore, is more secure and more protected from unauthorized access.