Here I am explaining the simple procedure of passing variables from a JSP page to another. One easy way is to pass them through a form as hidden variables. For example, I have the variable with name “parameter1″ and value and I want to pass it from page1.jsp to page2.jsp. On the form of page1.jsp I am writing the following:
<form method="post" action="page2.jsp">
<table>
....
<tbody><tr>
<td><input name="parameter1" value="<%=" type="hidden">></td>
</tr>
<input name="Submit" value="Done" onclick="Submit()" type="button">
<input name="Reset" value="Cancel" type="reset">
</tbody></table>
Now on page2.jsp I can access the “parameter1″ with the following statement:
HttpServeletRequest req;
req.getParameter("parameter1");


No Comments »