添加h:form:IllegalStateException之后:在提交响应后无法创建会话

时间:2015-01-27 11:26:11

标签: forms jsf session jsf-2

我正在使用Primefaces 4.0 + JSF 2.1 + Bootstrap 3,当我尝试在下面的块中输入“h:form”时出现错误:

Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed

所以,这段代码抛出上面的错误:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

<h:head />
<h:body>
    <ui:composition template="/templates/template.xhtml">
        <ui:define name="content">
            <h:form>
             hello world
            </h:form>
        </ui:define>
    </ui:composition>
</h:body>
</html>

如果我删除“h:form”,则会渲染“hello world”。

我试过这是我的web.xml,但也没有用:

<context-param>   
<param-name>
    com.sun.faces.writeStateAtFormEnd</param-name>   
<param-value>false</param-value>   
</context-param>

0 个答案:

没有答案