gpt4 book ai didi

javax.servlet.ServletException : ICEfaces requires the PersistentFacesServlet

转载 作者:行者123 更新时间:2023-12-01 14:43:13 26 4
gpt4 key购买 nike

我是 ICEFACES 的初学者,尝试使用一些 ICEFACES 组件成功运行我的第一个 ICEFACES 屏幕。开始使用。我正在使用 ICEFACES 1.8.2。

我从此链接复制了 web.xml 的内容:

http://res.icesoft.org/docs/v1_8_2/htmlguide/gettingstarted/SessionRendererTutorial11.html#1054095

下面是 faces-config.xml 文件:

<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<application>
<view-handler>
com.icesoft.faces.facelets.D2DFaceletViewHandler
</view-handler>
</application>
</faces-config>

下面是Test.jsp屏幕内容:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="ice" uri="http://www.icesoft.com/icefaces/component"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<ice:outputText id="txtHello" value="Hello ICEFaces"></ice:outputText> <br>
<ice:panelGroup title="Hello"></ice:panelGroup>
</f:view>
</body>
</html>

当我使用以下 URL 运行应用程序时:

http://localhost:8046/TestMojarra/faces/Test.jsp

我遇到异常:

javax.servlet.ServletException: ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings
javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)

java.lang.IllegalStateException: ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings
com.icesoft.faces.context.DOMResponseWriter.<init>(DOMResponseWriter.java:154)
com.icesoft.faces.context.DOMContext.createTemporaryDOMResponseWriter(DOMContext.java:182)
com.icesoft.faces.context.DOMContext.getDOMContext(DOMContext.java:228)
com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:89)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:151)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:151)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

但是如果我注释掉<ice:panelGroup>上述 jsp 文件中的一行,屏幕开始显示。

请告诉我问题出在哪里。

最佳答案

这就是我在 web.xml 中所做的一切。我有 servlet 声明

<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

以及到 servlet 的映射

<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/ifaces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>

不过,我总是使用 xhtml 文件,而不是 jsp 文件。但是,这对我来说总是有效。

编辑我已将您的示例重新编辑为 xhtml 格式。有两个标签不是有效的 xhtml。但这通常对我有用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:f="http://java.sun.com/jsf/core">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Insert title here</title>
</head>
<body>
<f:view>
<ice:outputText id="txtHello" value="Hello ICEFaces"></ice:outputText> <br/>
<ice:panelGroup title="Hello"></ice:panelGroup>
</f:view>
</body>
</html>

关于javax.servlet.ServletException : ICEfaces requires the PersistentFacesServlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15729071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com