Reputation: 25842
I have two JSP pages A
and B
and also a Servlet.
The flow is like this:
User fill in some information in page A
Then the user fill in some other information in page B
After the user finishes B, he/she will click a button and submit all data (from both A and B) to the Servlet.
How should I design this?
My plan is
In A's next
button, it is actually a <a>
tag with link to the href of B. All information from A should be passed to B via that link. I don't know how to do this step.
In B's finish
button, it is a form input submit button. I don't know whether I can or how I add A's data into this form.
Anyone can help me out?
Thanks
Upvotes: 2
Views: 2370
Reputation: 23413
In your A.jsp create a link, for e.g.: <a href="B.jsp?param1=value1¶m2=value2">Go to B</a>
Pass your parameters from URL.
In B.jsp use expression language to get parameters values:
<form action="FinalServlet" method="post">
<input type="text" name="p" value="your value"/>
<input type="hidden" name="p1" value="${param.param1}"/>
<input type="hidden" name="p2" value="${param.param2}"/>
.......
<input type="submit" value="Finish"/>
</form>
Hope this helps.
EDIT:
If you want to use a form with input fields in A.jsp:
<form action="B.jsp" method="post">
<input type="text" name="param1" value="value1"/>
<input type="text" name="param2" value="value2"/>
.......
<input type="submit" value="Finish"/>
</form>
You will receive parameters in B.jsp using the same EL.
Upvotes: 1