要传递值,必须
value="hiddenValue"在
<input>语句中包括隐藏值,如下所示:
<input type="hidden" id="thisField" name="inputName" value="hiddenValue">
然后,通过访问请求对象的参数,以与恢复可见输入字段的值相同的方式恢复隐藏的表单值。这是一个例子:
该代码在您要隐藏值的页面上。
<form action="anotherPage.jsp" method="GET"> <input type="hidden" id="thisField" name="inputName" value="hiddenValue"><input type="submit"> </form>
然后在“ anotherPage.jsp”页面上,通过调用
getParameter(Stringname)隐式
request对象的方法来调理值,如下所示:
<% String hidden = request.getParameter("inputName"); %>The Hidden Value is <%=hidden %>上面脚本的输出将是:
The Hidden Value is hiddenValue



