我正在从bean <ui:include src="#{criteriaBean.criteriaPage}" />
动态设置JSF包含,如果条件页面位于项目WebContent
的根目录下,它就可以正常工作。
出于维护目的,我希望将这些包含文件放在自己的文件夹中。
但是,如果我尝试将内容放入WebContent
根目录或WEB-INF
内部的文件夹中,请更新criteriaBean
以使路径看起来正确,并且尝试加载页面,我得到javax.faces.view.facelets.TagAttributeException
说明路径无效。
我甚至尝试过不使用bean并硬编码值来测试:<ui:include src="/WEB-INF/rptCriteria/test.xhtml" />
和<ui:include src="/rptCriteria/test.xhtml" />
,但我得到了同样的错误。
理想情况下,我希望WEB-INF
文件夹能够正常工作。
我可能遗失的任何想法?
这是完整的堆栈跟踪:
10:09:11,585 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SAAS].[Faces Servlet]] (http-/0.0.0.0:8888-5) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: javax.faces.view.facelets.TagAttributeException: /reportCriteria.xhtml @23,65 <ui:include src="/WEB-INF/rptCriteria/notDefined.xhtml"> Invalid path : /WEB-INF/rptCriteria/notDefined.xhtml
at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:125) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:116) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:106) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:111) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:320) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:379) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:358) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:902) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at gov.irs.saas.filter.SaasFilter.doFilter(SaasFilter.java:132) [classes:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
答案 0 :(得分:0)
根本问题似乎与Eclipse没有为xhtml
文件设置默认编码这一事实有关。即使单个文件以<?xml version="1.0" encoding="UTF-8" />
开头 - 当文件部署到JBoss EAP 6.1时,也存在问题。
我更新了Eclipse(Window -> Preferences -> General + Content Types + Text
)以确保所有xhtml
文件的默认编码都设置为UTF-8
,并且在重新启动Eclipse并重新部署到代码后,异常消失了现在一切正常。
这也在另一台机器上验证过。