To pass a value, you must include the hidden value value="hiddenValue" in the <input> statement, for example:
<input type="hidden" id="thisField" name="inputName" value="hiddenValue">
Then you restore the value of the hidden form in the same way as you restore the value of the visible input fields by accessing the parameter of the query object. Here is an example:
This code appears on the page where you want to hide the value.
<form action="anotherPage.jsp" method="GET"> <input type="hidden" id="thisField" name="inputName" value="hiddenValue"> <input type="submit"> </form>
Then, on the 'anotherPage.jsp' page, you restore the value by calling the getParameter(String name) method of the implicit request object, like this:
<% String hidden = request.getParameter("inputName"); %> The Hidden Value is <%=hidden %>
The output of the above script will be:
The Hidden Value is hiddenValue
source share