Reputation: 96391
Say you have 2 pages:
- one.jsp
- two.jsp
In one.jsp
you
- MyBean mb = new myBean();
- mb.setValue1("value1");
- mb.setValue2("value2");
How can you make mb
instance available in two.jsp
on <input type="submit" name="submit">
Upvotes: 1
Views: 1964
Reputation: 691765
Either you store the bean in the session during the first request, and retrieve it from the session during the second one, or you store value1 and value2 in hidden fields of your form, and recreate the bean using the corresponding request parameters in the second request.
Note that JSPs should not contain Java code. See How to avoid Java code in JSP files?
Upvotes: 2