簡體   English   中英

javax.servlet.ServletException:ICEfaces需要PersistentFacesServlet

[英]javax.servlet.ServletException: ICEfaces requires the PersistentFacesServlet

我是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)

但是,如果我將上述jsp文件中的<ice:panelGroup>行注釋掉,則會顯示該屏幕。

請讓我知道問題出在哪里。

這是我在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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM