多个jsp页面的表单传递问题

思路:一个jsp页面接收到上一个jsp页面的表单,再加上自身的表单,两个表单传向下一个jsp页面。两个表单也可以整理成一个表单,然后传递到下一个表单。

由于页面较多,考虑的是将所有表单依次传递,到最后一个页面然后再一起提交到后台,但是传递过程中永远只传递到了上一个页面的表单,本人小白,求教如何实现这样的功能。

a.jsp

 <form method="post" id="survey" name="survey" action="timesOfjoin.jsp">
 ...
 <div id="action" method="post"
                            style="text-align:center;margin:0 auto;">
                            <button id="survey_submit" type="button"
                                onclick="document.getElementById('survey').submit();"
                                style="padding:4px;text-align:center;font-size:16px; ">下一页</button>

timeOfjoin.jsp

 <form method="post" id="survey" name="survey" action="workIndustry.jsp">
 ...
 <div id="action" style="text-align:center;margin:0 auto;">
                            <button id="survey_submit" type="button"
                                onclick="document.getElementById('survey').submit();"
                                style="padding:4px;text-align:center;font-size:16px; ">下一页</button>

workIndustry.jsp

 <form method="post" id="survey" action="areaIninterest.jsp">
 ...
 <div id="action" style="text-align:center;margin:0 auto;">
                            <button id="survey_submit" type="button"
                                onclick="document.getElementById('survey').submit();"
                                style="padding:4px;text-align:center;font-size:16px; ">下一页</button>
                        </div>

为什么不把这些数据在JavaScript中操作呢,弄个共用的js

要把上个表单的字段都克隆一遍。
a.jsp

    <form method="post" id="survey" name="survey" action="timesOfjoin.jsp">
        <input name="v1" value="abc" />
        ...
        <button ...>下一页</button>

timeOfjoin.jsp

    <form method="post" id="survey" name="survey" action="workIndustry.jsp">
        <input name="v1" type="hidden" value="<%= request.getParameter('v1') %>" />
        <input name="v2" value="def" />
        ...
        <button ...>下一页</button>

workIndustry.jsp

     <form method="post" id="survey" action="areaIninterest.jsp">
        <input name="v1" type="hidden" value="<%= request.getParameter('v1') %>" />
        <input name="v2" type="hidden" value="<%= request.getParameter('v2') %>" />
        <input name="v3" value="xyz" />
        ...
        <button ...>下一页</button>