JSF mojarra与primefaces从Glassfish迁移到Wildfly - CSS和主题没有加载

时间:2014-04-28 23:04:33

标签: jsf primefaces glassfish migration wildfly

我们正在将我们的应用程序从glassfish迁移到wildfly。然而,primefaces主题不再加载。我正在附加已加载的页面。

Firebug控制台显示错误 - ReferenceError:$未定义

的index.xhtml    `

<?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:p="http://primefaces.org/ui"
>
    <h:head>           
        <link rel="shortcut icon"
              href="http://www.hs-furtwangen.de/fileadmin/templates/favicon.ico"
              type="image/x-ico; charset=binary" />
        <f:facet name="first">
            <meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
            <title>#{messages.finquasCompleteName}</title>
        </f:facet>                    
    </h:head>
    <h:body>
        <ui:composition template="./mainTemplate.xhtml">
            <ui:define name="NonServiceView">
                <h:form>
                    <p:growl autoUpdate="true" />

                    <div class="activitySream">
                        <div class="activityStreamHeader">
                            #{messages.activityStream}
                        </div>
                        <p:outputPanel deferred="true">
                            <p:dataList id="id_list_activity_stream"
                                        value="#{activityStreamController.logEntries}" var="logEntry"
                                        type="none" emptyMessage="#{messages.noActivitiesFound}">  
                                <div class="activityDescriptionArea">
                                    <div class="activityIconArea">
                                        <h:outputText value="#{activityStreamController.getActionSpecificIconCode(logEntry.changeType)}"
                                                      escape="false" />
                                    </div>
                                    <div class="activityDescription">
                                        <h:outputText value="#{logEntry.creator.name}" styleClass="boldLabel" />
                                        <h:outputText value="#{activityStreamController.getActivityTextFirstPartForLogEntry(logEntry)}" />
                                        <h:commandLink styleClass="boldLabel"
                                                       action="#{activityStreamController.navigateToEntity(logEntry.abstractEntity)}">
                                            #{activityStreamController.getEnitityText(logEntry.abstractEntity)} 
                                        </h:commandLink>
                                        <h:outputText value="#{activityStreamController.getChangeLogLabelOfLogEntry(logEntry)}." />
                                        <div class="activityDate">
                                            <h:outputText value="#{logEntry.changeDate}">
                                                <f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" timeZone="Europe/Berlin" />
                                            </h:outputText> 
                                        </div>
                                    </div>
                                </div>
                            </p:dataList>  
                            <p:commandButton value="#{messages.showMore}" action="#{activityStreamController.showMore()}" 
                                             update="id_list_activity_stream"
                                             rendered="#{not empty activityStreamController.logEntries}"
                                             styleClass="plainText greenButton showMoreActivitiesButton"/>

                        </p:outputPanel>
                    </div>
                </h:form>
            </ui:define>            
        </ui:composition>    
    </h:body>
</html>`

mainTemplate.xhtml

`

 <?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:p="http://primefaces.org/ui"
>

<h:body>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
    <ui:composition template="./headerFooterLoggedInPagesTemplate.xhtml">
        <ui:define name="leftHeaderUnit">
            <p:commandButton
                id="id_btn_home"
                action="#{navigationController.navigateHome()}"
                value="#{iconSetController.home}"
                escape="false" title="#{messages.home}"
                update=":structureTreeForm" ajax="false" />
        </ui:define>

        <ui:define name="rightHeaderUnit">
            <p:commandButton id="id_btn_main_user_profile"
                             action="userProfile"
                             title="#{messages.myProfile}" 
                             value="#{iconSetController.user}"
                             ajax="false"
                             escape="false" />
            <p:commandButton id="id_btn_main_help"
                             action="help"
                             title="#{messages.help}" 
                             value="#{iconSetController.help}"
                             escape="false" />
            <p:commandButton id="id_btn_main_logout"
                             title="#{messages.logout}"
                             value="#{iconSetController.logout}"
                             escape="false"
                             action="#{navigationController.logout()}" />
        </ui:define>

        <!--The empty header field is a necessary in order to display the collapsible button-->
        <ui:define name="navigationArea">     
            <p:layoutUnit position="west" 
                          collapsible="true"
                          header=""
                          effect="none"
                          resizable="true" id="id_lu_navigationBarLeft" size="320" minSize="300">         
                <p:tabView id="id_tabView_navigationBar" 
                           dynamic="true"
                           activeIndex="#{navigationController.activeNavigationBarTabIndex}"
                           styleClass="finquasTabs">
                    <p:ajax event="tabChange" listener="#{navigationController.onNavigationBarTabChange}" />  
                    <p:tab title="#{messages.myServicesTab}">
                        <p:panel rendered="#{not empty navigationController.administrationServicesOfCurrentUser}" header="#{messages.myAdministrationServices}">
                            <h:form id="myAdministrationServicesForm">
                                <p:dataList id="id_list_my_administration_services"
                                            value="#{navigationController.administrationServicesOfCurrentUser}"
                                            var="service"
                                            rendered="#{not empty navigationController.administrationServicesOfCurrentUser}">
                                    <p:column>
                                        <h:commandLink
                                            action="#{navigationController.viewServiceViaObject(service)}">
                                            #{service.name} 
                                        </h:commandLink>
                                    </p:column>
                                </p:dataList>
                            </h:form>
                        </p:panel>
                        <p:panel rendered="#{not empty navigationController.educationalServicesOfCurrentUser}" header="#{messages.myEducationalServices}">
                            <h:form id="myEducationalServicesForm">
                                <p:dataList id="id_list_my_product_services"
                                            value="#{navigationController.educationalServicesOfCurrentUser}"
                                            var="service"
                                            rendered="#{not empty navigationController.educationalServicesOfCurrentUser}">
                                    <p:column>
                                        <h:commandLink
                                            action="#{navigationController.viewServiceViaObject(service)}">                                            
                                            <h:outputText value="#{service.name}" />                                                                                   
                                            <h:outputText value=" #{messages[service.getDegree().getAbbreviation()]}#{messages[service.getDegreeType().getAbbreviation()]}" rendered="#{navigationController.isDegreeProgram(service)}"/>                                                                                      
                                            <h:outputText value=" #{navigationController.getStateOfService(service)}" rendered="#{navigationController.isServiceDegreeProgramOrStudyModule(service)}"/>                                                                                      
                                        </h:commandLink>
                                    </p:column>
                                </p:dataList>
                            </h:form>
                        </p:panel>
                        <p:panel rendered="#{not empty navigationController.peerReviewsOfCurrentUser}" header="#{messages.myPeerReviews}">
                            <h:form id="myPeerReviewsForm">
                                <p:dataList id="id_list_my_review_services"
                                            value="#{navigationController.peerReviewsOfCurrentUser}"
                                            var="service"
                                            rendered="#{not empty navigationController.peerReviewsOfCurrentUser}">
                                    <p:column>
                                        <h:commandLink
                                            action="#{navigationController.viewServiceViaObject(service)}">
                                            #{service.name} (#{messages[service.state.class.name]})
                                        </h:commandLink>
                                    </p:column>
                                </p:dataList>
                            </h:form>
                        </p:panel>
                        <p:panel rendered="#{not empty navigationController.qualityReportServicesOfCurrentUser}" header="#{messages.myQualityReportServices}">
                            <h:form id="myQualityReportServicesForm">
                                <p:tree id="id_list_my_quality_report_services"
                                        value="#{navigationController.qualityReportServiceRoot}"
                                        var="serviceNode"
                                        dynamic="true"
                                        rendered="#{not empty navigationController.qualityReportServicesOfCurrentUser}">
                                    <p:ajax event="expand" listener="#{navigationController.onNodeExpandQualityReportGraph}" />
                                    <p:ajax event="collapse" listener="#{navigationController.onNodeCollapse}" />
                                    <p:treeNode>
                                        <h:commandLink
                                            action="#{navigationController.viewServiceViaObject(serviceNode)}">                                                                                         
                                            <span title="#{messages.qualityReportFinished}"><h:panelGroup layout="block" class="greenCircle" rendered="#{serviceNode.state.position == 3}"/> </span>
                                            <span title="#{messages.qualityReportWaitingForStatement}"><h:panelGroup layout="block" class="yellowCircle" rendered="#{serviceNode.state.position == 2}"/></span> 
                                            <span title="#{messages.qualityReportWaitingForStatementStudyDean}"><h:panelGroup layout="block" class="redCircle" rendered="#{serviceNode.state.position == 1}"/></span> 
                                            #{serviceNode.simpleName}                                            
                                        </h:commandLink>
                                    </p:treeNode>
                                </p:tree>                                
                            </h:form>
                        </p:panel>
                    </p:tab>
                    <p:tab title="#{messages.serviceStructureTab}">
                        <p:panel header="#{messages.search}" styleClass="finquasinput">
                            <h:form id="id_form_main_search">
                                <p:autoComplete id="id_input_main_search"
                                                forceSelection="true"
                                                placeholder="#{messages.autoCompleteHint}"
                                                value="#{navigationController.serviceName}" 
                                                effect="fade"
                                                required="true"
                                                requiredMessage="#{messages.noServiceFound}"
                                                styleClass="autocompleteService"                                                
                                                completeMethod="#{navigationController.completeService}" />
                                <p:commandButton id="id_btn_main_search"
                                                 value="#{iconSetController.search}" escape="false"                                                 
                                                 action="#{navigationController.viewServiceViaAutoComplete}"
                                                 ajax="false" />
                            </h:form>
                        </p:panel>
                        <p:panel header="#{messages.structure}">
                            <h:form id="structureTreeForm">
                                <p:tree value="#{navigationController.serviceRoot}"
                                        dynamic="true"
                                        var="serviceNode" 
                                        styleClass="finquastree" 
                                        animate="true">
                                    <p:ajax event="expand" listener="#{navigationController.onNodeExpandEducationalServiceGraph}" />
                                    <p:ajax event="collapse" listener="#{navigationController.onNodeCollapse}" />
                                    <p:treeNode>
                                        <h:commandLink
                                            action="#{navigationController.viewServiceViaObject(serviceNode)}">
                                            <h:outputText value="#{serviceNode.name} #{messages[serviceNode.getDegree().getAbbreviation()]}#{messages[serviceNode.getDegreeType().getAbbreviation()]}" rendered="#{serviceNode['class'].simpleName == 'DegreeProgram'}"/>                                                                                   
                                            <h:outputText value="#{serviceNode.name}" rendered="#{serviceNode['class'].simpleName != 'DegreeProgram'}"/>                                                                                   
                                        </h:commandLink>
                                    </p:treeNode>
                                </p:tree>
                            </h:form>
                        </p:panel>
                    </p:tab>
                </p:tabView>
            </p:layoutUnit>
        </ui:define>  
    </ui:composition>
</ui:composition>
</h:body>

</html>`

headerFooterTemplate.xhtml

`

 <?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:p="http://primefaces.org/ui"
    >

    <h:body>
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://xmlns.jcp.org/jsf/core"
          xmlns:p="http://primefaces.org/ui">

        <f:view contentType="text/html">
                <ui:insert name="loggedInCheck" />  

                <f:facet name="last">
                    <h:outputStylesheet library="css" name="default.css" />
                    <h:outputScript library="scripts" name="primefacesLocalization.js"
                                    target="head" />
                </f:facet>
                <p:layout fullPage="true">
                    <p:layoutUnit id="id_lu_headerUnit" position="north">
                        <h:form id="id_form_headerForm">
                            <p:toolbar styleClass="finquasheader">
                                <p:toolbarGroup styleClass="headerBar">
                                    <ui:insert name="leftHeaderUnit" /> 
                                </p:toolbarGroup>
                                <p:toolbarGroup align="right" styleClass="headerBar">       
                                    <ui:insert name="rightHeaderUnit" /> 
                                </p:toolbarGroup>
                            </p:toolbar>
                        </h:form>
                    </p:layoutUnit>
                    <ui:insert name="navigationArea" /> 

                    <p:layoutUnit id="id_lu_centerUnit" position="center">                         
                        <div id="contentArea">
                            <div class="nonServiceView">
                                <ui:insert name="NonServiceView" />  
                            </div>
                            <ui:insert name="ServiceView" />
                        </div>
                    </p:layoutUnit>

                    <p:layoutUnit position="south" id="footerUnit">
                        <h:form>
                            <p:toolbar styleClass="finquasfooter">
                                <p:toolbarGroup>
                                    <ui:insert name="leftFooterContent" />  
                                </p:toolbarGroup>
                                <p:toolbarGroup align="right" styleClass="footerToolbar">
                                    #{messages.finquasCompleteName}
                                </p:toolbarGroup>
                            </p:toolbar>
                        </h:form>
                    </p:layoutUnit>
                </p:layout>            
        </f:view>
    </ui:composition>
    </h:body>
    </html>`

headerFooterLoggedInPagesTemplate.xhtml

  `  <?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:p="http://primefaces.org/ui"
>

<h:body>
<ui:composition template="./headerFooterTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <ui:param name="currentUser" value="#{sessionController.currentUser}" />
    <ui:define name="loggedInCheck">
        <c:if test="#{!sessionController.loggedIn}">
            <meta HTTP-EQUIV="REFRESH"
                  content="0;URL='#{navigationController.serverUrl}'" />        
        </c:if>        
    </ui:define>
    <ui:define name="leftFooterContent">
        #{currentUser.firstName} #{currentUser.lastName}
        <script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

            ga('create', 'UA-49887094-1', 'hs-furtwangen.de');
            ga('send', 'pageview');

        </script>
    </ui:define>
</ui:composition>
</h:body>
</html>`

1 个答案:

答案 0 :(得分:1)

我收到了错误。我的所有模板页面都使用了合成,每个页面都有自己的标题。虽然这适用于玻璃鱼,但野生蝇不允许这样做。 从除基础模板以外的所有模板中移除头部并使基础模板不是合成解决了这个