2013-03-01 151 views
1

您好我有<ui:include>標籤的問題,我嘗試包括網頁到另一個網頁,我也得到javax.faces.view.facelets.TagAttributeException:無效的路徑

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.xhtmlindex_core/naglowek.xhtml等Eclipse本身給了我一個提示,並當我點擊名稱naglowek.xhtml按住Ctrl正確帶我到頁面

如何解決我T'這可能是由於使用庫OpenFaces造成的嗎?

回答

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">