我已阅读在这个论坛本身,当我们使用 了request.setAttribute 和 request.getAttribute如何请求参数的值存储在JSP的
它的值只保留,直到在JSP页面加载。 所以他们建议使用隐藏的形式,当我正在使用隐藏的形式 - 我似乎无法得到正确的。它表示不允许我使用无效值来确保通过.setAttribute存储的所有值都具有一些初始化值。
这里是代码中错误显示
**org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 83 in the jsp file: /season1.jsp
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
80: <!-- end .content --></div>
81: </form>
82: <%i=1;%>
83: <input type="hidden" name="epnostorage" value="<%= request.setAttribute("epno", epno) %>" />
84: <input type="hidden" name="casestorage" value="<%= request.setAttribute("case", i) %>" />
85: <%
86: }
An error occurred at line: 84 in the jsp file: /season1.jsp
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
81: </form>
82: <%i=1;%>
83: <input type="hidden" name="epnostorage" value="<%= request.setAttribute("epno", epno) %>" />
84: <input type="hidden" name="casestorage" value="<%= request.setAttribute("case", i) %>" />
85: <%
86: }
87: else if(i==1)
**
有人建议我,如果我想使用一个页面隐藏形式的值是更好的选择..虽然我想在这里做一个动态页面,它必须在页面上再次使用变量的值,所以你可以建议我该怎么做。 –
getAttribute –
如果你使用会话来设置属性将它转发到我添加会话 –