【发布时间】:2011-12-25 17:13:14
【问题描述】:
在添加<h:form> 后,我在一个非常简单的 JSF 2 页面中遇到以下异常:
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2758)
at org.apache.catalina.connector.Request.getSession(Request.java:2268)
我在 Tomcat 7.0.22 和 JDK 7 上使用 Mojarra 2.1.3 和 PrimeFaces3.0M4。
页面是一个很基础的数据表:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:dataTable var="car" value="#{tableBean.cars}">
......
</p:dataTable>
</h:form>
</h:body>
</html>
页面在浏览器上正确显示,但在控制台上我看到了异常。如果我删除 <h:form>,异常确实会消失。
这是怎么引起的,我该如何解决?
【问题讨论】:
标签: forms session jsf jsf-2 illegalstateexception