문제

I have few xhtml sites and the one which uses PrimeFaces print this error: One or more resources have the target of 'head'

this is my template file:

<html lang="pl"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.org/ui"
  xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-type" />

    <link href="resources/css/bootstrap.css" rel="stylesheet"/>
    <link href="resources/css/font-awesome.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="resources/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="resources/css/style-mobile.css"/>

    <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script src="resources/js/bootstrap.js"></script>
</h:head>
<h:body>
    <ui:insert name="header">
        <ui:include src="/global/top-menu.xhtml"/>
    </ui:insert>

    <ui:insert name="content">
        <ui:include src="/index.xhtml"/>
    </ui:insert>

    <ui:insert name="footer">
        <ui:include src="/global/footer.xhtml"/>
    </ui:insert>
</h:body>
</html>

and this is the content where the error is printed:

<!DOCTYPE html>
<html lang="pl"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>

</h:head>

<h:body>
    <ui:composition template="/WEB-INF/template/mainLayout.xhtml">
        <ui:define name="content">

            <h:outputScript library="js" name="calendar-pl.js"/>
            <h:outputScript library="js" name="registration.js"/>

            <div class="container registration-container">
             //some PrimeFaces stuff which works properly by the way
            </div>

        </ui:define>
    </ui:composition>
</h:body>
</html>
도움이 되었습니까?

해결책

I am using ui:composition this way:

The template file:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html" locale="en">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <ui:insert name="headerExtend"></ui:insert>
</h:head>
<h:body>
         <ui:insert name="content"></ui:insert>
    </h:body>
 </f:view>
</html>

And here is the actual content inserted:

<ui:composition
template="./layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"

xmlns:p="http://primefaces.org/ui">
<ui:define name="content">
        <h:form>
        </h:form>
    </ui:define>
</ui:composition>

다른 팁

What would you say to the following content of your view file:

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="/WEB-INF/template/mainLayout.xhtml">

    <ui:define name="content">

        <h:outputScript library="js" name="calendar-pl.js"/>
        <h:outputScript library="js" name="registration.js"/>

        <div class="container registration-container">
         //some PrimeFaces stuff which works properly by the way
        </div>

    </ui:define>
</ui:composition>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top