javax.faces.view.facelets.TagAttributeException:路径无效

时间:2013-03-01 08:50:58

标签: java jsf openfaces

您好<ui:include>标签有问题,我尝试将网页包含到另一个页面,然后我

javax.faces.view.facelets.TagAttributeException: /index.xhtml @27,51 <ui:include src="index_core/naglowek.xhtml"> Invalid path : index_core/naglowek.xhtml
    com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:125)
    javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
    javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
    javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
    com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
    com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:902)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:41)

这很奇怪,因为当我使用this页面中的示例时,一切正常。

<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:o="http://openfaces.org/">
<h:head>
    <title>PIR Kreator Ofert</title>
    <script src="/WEB-INF/resources/script.js" type="text/javascript"></script>
</h:head>
<h:body>
    <h:form id="form">

        <!-- EDIT TITLE -->

        <o:tabbedPane>
            <o:subPanel caption="Nagłówek">

                <ui:include src="index_core/naglowek.xhtml"/>

            </o:subPanel>
            <o:subPanel caption="Produkty">

                <ui:include src="index_core/produkty.xhtml" />

            </o:subPanel>

            <!-- INSTALACJA TAB -->

            <o:subPanel caption="Montaz">

                <ui:include src="index_core/montaz.xhtml" />

            </o:subPanel>

            <!-- PANEL USLUGI -->

            <o:subPanel caption="Usługi">

                <ui:include src="index_core/uslugi.xhtml" />

            </o:subPanel>
        </o:tabbedPane>

        <o:commandButton id="printButton" value="Drukuj"
            actionListener="#{pdf.printt}" />

        <!-- AJAX -->

        <o:ajax id="selectService" standalone="true"
            execute=":form:serviceTable" render=":form:selectedServiceTable" />

        <o:ajax id="selectAsm" standalone="true" execute=":form:assemblyTable"
            render=":form:selectedAsmTable" />

        <o:ajax id="setTitleDesc" standalone="true"
            execute=":form:opisArea :form:titleText" />

        <o:ajax id="printProduct" standalone="true"
            execute=":form:resultTablePanel" />

        <o:ajax id="addProduct" standalone="true"
            render=":form:resultTablePanel" execute=":form:produktMenu" />

    </h:form>
</h:body>
</html>

和naglowek.xhtml来源:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:o="http://openfaces.org/">

    <h:outputLabel id="dodajTytulCheckbox" />
    <h4>Edytuj tytuł:</h4>
    <o:selectBooleanCheckbox id="addTitleC" value="#{ajaxBean.editTitle}">
        <o:ajax event="click" render="titleText" />
    </o:selectBooleanCheckbox>
    <o:inputText id="titleText" value="#{pdf.title}"
        disabled="#{not ajaxBean.editTitle}" />
    <br />

    <!-- EDIT OPIS -->

    <h:outputLabel id="dodajOpisCheckbox" value="Opis" />
    <o:selectBooleanCheckbox id="addOpisC" value="#{ajaxBean.opis}">
        <o:ajax event="click" render=":form:opisArea" />
    </o:selectBooleanCheckbox>
    <h:panelGroup id="opisArea">
        <o:inputTextarea value="#{pdf.opis}" disabled="#{not ajaxBean.opis}" />
    </h:panelGroup>
    <br />
    <h:commandButton value="Ustaw" type="button"
        onclick="O$('form:setTitleDesc').run()" />

</ui:composition>

enter image description here

我使用了多种方式,例如指定路径:/index_core/naglowek.xhtml index_core/naglowek.xhtml等.Eclipse本身给了我一个提示,当我点击名称naglowek.xhtml时按住Ctrl键正确地带我到页面

如何解决?这可能是由于使用了OpenFaces库吗?

1 个答案:

答案 0 :(得分:0)

我解决了它,它是关于页面上的编码,只需添加以下代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">