我使用的是使用RichFaces 4.0的简单示例程序,但遗憾的是我无法为Richfaces 4.0配置视图处理程序。
我的WEB-INF文件夹中有以下库
公地BeanUtils的-1.7.0.jar 公地集合-3.2.jar 公共沼气池-1.8.jar 共享记录-1.0.4.jar cssparser-0.9.5.jar 番石榴r08.jar JSF的API-2.0.4-b09.jar JSF的IMPL-2.0.4-b09.jar JSTL-1.2.jar RichFaces的组件的API-4.0.0.20110209-M6.jar RichFaces的组件-UI-4.0.0.20110209-M6.jar RichFaces的核心-API 4.0.0.20110209-M6.jar RichFaces的核心 - IMPL-4.0.0.20110209-M6.jar SAC-1.3.jar
我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”xsi:schemaLocation =“http://java.sun.com/xml/ns/javaee {{ 3}}“&GT;
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinningClasses</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
my faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd“&GT;
的index.jsp
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
start.xhtml
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
RichFaces的
<rich:panel header="RichFaces">
发生的事情是因为我没有任何视图处理程序所以当我运行应用程序时,系统会提示我从浏览器下载文件?
如果我包含jsf-facelets.jar并在faces-config.xml中配置它,那么我在部署时会遇到标记lib错误。浏览器不显示任何只显示文本的RichFaces4.0组件。
请参阅以下错误以供参考。
INFO:Container org.apache.catalina.core.ContainerBase。[Catalina]。[localhost]。[/ RichFacesJSF20]已经启动
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-facelets.jar!/ META-INF / JSF-core.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-facelets.jar!/ META-INF / JSF-html.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-facelets.jar!/ META-INF / JSF-ui.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-facelets.jar!/ META-INF / JSTL-core.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-facelets.jar!/ META-INF / JSTL-fn.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
信息:添加了以下库:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/jsf-impl-2.0.4 -b09.jar!/META-INF/mojarra_ext.taglib.xml
22-Feb-2011 19:08:52 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
严重:加载库时出错:jar:file:/ C:/Documents%20and%20Settings/modhas2/My%20Documents/NetBeansProjects/RichFacesJSF20/build/web/WEB-INF/lib/richfaces-components-ui-4.0 .0.20110209-M6.jar!/META-INF/a4j.taglib.xml
java.io.IOException:解析[jar:file:/ C:/ Documents%20和%20Settings / modhas2 / My%20Documents / NetBeansProjects / RichFacesJSF20 / build / web / WEB-INF / lib / richfaces-components-时出错ui-4.0.0.20110209-M6.jar!/META-INF/a4j.taglib.xml]:
at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:410)
at com.sun.facelets.compiler.TagLibraryConfig.loadImplicit(TagLibraryConfig.java:431)
at com.sun.facelets.compiler.Compiler.initialize(Compiler.java:87)
at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:218)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:149)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:100)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:517)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:59)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
引起:org.xml.sax.SAXException:错误处理[jar:file:/ C:/ Documents%20和%20Settings / modhas2 / My%20Documents / NetBeansProjects / RichFacesJSF20 / build / web / WEB-INF / lib /richfaces-components-ui-4.0.0.20110209-M6.jar!/META-INF/a4j.taglib.xml@2,255]
at com.sun.facelets.compiler.TagLibraryConfig$LibraryHandler.error(TagLibraryConfig.java:376)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1318)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:407)
... 39 more
请使用Facelets JSF2.0建议如何使用RichFaces4.0?
答案 0 :(得分:1)
使用RichFaces时不需要配置视图处理程序4. Facelets是使用的默认视图处理程序。我建议使用RichFaces Maven原型创建一个新的RichFaces 4项目 - 您将立即获得所需的一切。