2 Replies Latest reply on Apr 13, 2012 2:18 PM by Ana B

    Richfaces 4.1 with Mojarra 2.1.7 resources are all in the body instead of head of the html document

    Ana B Newbie

      Hello,

       

      I just tried upgrading to JBoss AS 7.1.1 which comes prepackaged with JSF 2.1.7. Before I was using JSF 2.0.4 and everything was fine with my RichFaces. It seems that all my Richfaces resources such as javax.faces.resource/richfaces.js.seam and javax.faces.resource/richfaces-event.js.seam are being included in the body of the rendered html page instead of the head.

       

      I have tried researching this issue online and I can't find any info on it. I have an h:head tag in my document so that isn't the issue.

       

      Please help

       

      Thanks.

        • 1. Re: Richfaces 4.1 with Mojarra 2.1.7 resources are all in the body instead of head of the html document
          Brian Leathem Master

          I've seen some cases where mojarra's treatment of templates and includes has changed.  Can you pust a sample page, and template?  A fully working example that I can run locally would be best.

           

          Cheers,

          Brian Leathem

          • 2. Re: Richfaces 4.1 with Mojarra 2.1.7 resources are all in the body instead of head of the html document
            Ana B Newbie

            Thank you for responding. Our application is huge. My company also has a very strict policy about posting internal code. Here are the stripped down versions of our templates and a page. I can create a sample app next week if this isn't sufficient. It's very possible I am doing something stupid. Currently our code runs without any problems in JBoss 7.0.1, mojarra 2.0.4 and Richfaces 4.1. It's when we tried switching to JBoss 7.1.1 and mojarra 2.1.7 that we started experiencing resource loading issues.

             

            template-main.xhtml:

             

             

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
             <f:view contentType="text/html" 
                   xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:x="http://java.sun.com/jsf/composite/htmlx"
                  xmlns:a4j="http://richfaces.org/a4j"
                  xmlns:f="http://java.sun.com/jsf/core"
                  xmlns:h="http://java.sun.com/jsf/html">
            <html>
            <h:head>
                <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/libraries/cookieAPI.js?p=1"></script>
                <script language="javascript" type="text/javascript">
                            var onloadCallbacks=new Array();
                             function registerOnloadCallback(method){
                                 onloadCallbacks[onloadCallbacks.length]=method;
                             }
                             function fireOnloadCallback(){
                                var loader=0;
                                for (loader=0; loader &lt; onloadCallbacks.length; loader++){
                                    onloadCallbacks[loader]();
                                }
            
                             }
                </script>
            
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            
                <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
                <title><ui:insert name="title"/> Sample Title</title>
            
                <ui:insert name="head"/>
            
                <script type="text/javascript">
                     window.onload=fireOnloadCallback;
                </script>
            
            
            </h:head>
            <ui:insert name="body"/>
            
            
            </html>
            </f:view>
            

             

            template-page.xhtml:

             

             

            <!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:ui="http://java.sun.com/jsf/facelets"
                  xmlns:x="http://java.sun.com/jsf/composite/htmlx"
                  xmlns:a4j="http://richfaces.org/a4j"
                  xmlns:ws="customtags/jsf"
                  xmlns:h="http://java.sun.com/jsf/html"
                  xmlns:f="http://java.sun.com/jsf/core"
                  xmlns:rich="http://richfaces.org/rich">
            
                <ui:composition template="../template-main.xhtml">
                    <ui:define name="head">
                    <link rel="shortcut icon" href="#{facesContext.externalContext.requestContextPath}/img/favicon.ico"/>
                    <link charset="utf-8" title="Global" media="screen" type="text/css" href="#{facesContext.externalContext.requestContextPath}/css/custom.css" rel="stylesheet"/>
                    <script src="#{facesContext.externalContext.requestContextPath}/js/scripts.js" language="JavaScript" type="text/javascript" ></script>
                        <script type="text/javascript">
                            try {
                                document.execCommand('BackgroundImageCache', false, true);
                            } catch(e) {}
            
                            var blankImg = "#{facesContext.externalContext.requestContextPath}/img/1px.gif";
                            var servletContext = "#{facesContext.externalContext.requestContextPath}";
            
                        </script>
                        <style type="text/css">
                              .wspngfix{ behavior: url(#{facesContext.externalContext.requestContextPath}/css/iepngfix.htc) }
                        </style>
            
            
                        <script defer="true" type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/pngfix.js"></script>
            
                        <!--  bunch of other js includes -->
            
                        <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/base64.js"></script>
            
                        <ui:insert name="moreheader"/>
                        <ws:deviceConnect userAuth="#{applicationFilter.userauth}"/>
            
                    </ui:define>
                    <ui:define name="body">
                        <h:body>
                            <script language="javascript" type="text/javascript">
                                function checkOS() {
                                    if (navigator.appVersion.indexOf("Mac") != -1)
                                        return MAC;
                                    else if (navigator.appVersion.indexOf("Win") != -1)
                                        return WINDOWS;
                                    else if (navigator.appVersion.indexOf("Linux") != -1)
                                        return LINUX;
                                    else
                                        return UNKNOWN;
                                }
                            </script>
                            <script defer="defer" language="javascript" type="text/javascript">
                                 initSessionCheck();
                            </script>
                            <!-- bunch of layout divs. It's nothing but divs and spans with css classes-->
                            <ui:insert name="bodyContent"/>
            
                            <!-- closing those layout divs. It's nothing but divs and spans with css classes-->
                        </h:body>
                    </ui:define>
                </ui:composition>
            </html>
            

             

            page.xhtml

             

             

             

            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:x="http://java.sun.com/jsf/composite/htmlx"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:ws="customtags/jsf"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                template="../layout/main/template-page.xhtml">
            
                    <ui:define name="title">
                        <!--EL to get the title -->
                    </ui:define>
            
                    <ui:define name="moreheader">
                        <meta name="description" content="#{seamFuncs.evalEL(dbk.get('vendor.all'))}"></meta>
                    </ui:define>
            
                    <ui:define name="bodyContent">
                        <c:set var="pageName" value="#{dbk.get('path.vendor')}: #{vendorBean.companyname}" />
                        <x:div styleClass="awMarginTop-Five">
                             <ws:searchbar isListPage="true" pageName="#{pageName}"/>
                         </x:div>
                    
                        <x:div styleClass="awMarginTop-Fifteen">
                            <pre class="cattitle listTitleMargin awVendorTitlePre"><ws:listTitle pageName="#{pageName}"/></pre>
                        </x:div>
                         <ws:subCategoryViewer/>
                         <h:form id="categorynav" >
                        <div class="leftnavdiv"> 
                            <h:panelGrid cellpadding="0" cellspacing="0" columns="1" rowClasses="navfacet1,navfacet2">
                                <h:outputLink  value="#{categoryNavBean.navToCategory(cat.id)}" onclick="recordCategoryNavigation('#{trackingBean.getEscapedString(dbk.get('navigation.categories.title'))}','category nav');">
                                       <h:outputText value="#{dbk.get('navigation.categories.title')}"/>
                                </h:outputLink>
                                <h:graphicImage styleClass="awNavImg" width="75px" height="1px"  value="/img/top_navseperator.gif" /> 
                            </h:panelGrid>
                            <rich:dataTable id="catNav" styleClass="catclass awFixedTable" value="#{catDataProvider.getCategories(0)}" var="cat" 
                            rowClasses="homerow1" rendered="#{catDataProvider.getCategories(0).size() gt 0}">
                                <h:column>
                                    <pre class="categories">
                                    <h:outputLink  styleClass="catLink" value="#{categoryNavigation.navToCategory(cat.id)}" onclick="recordCategoryNavigation('#{trackingBean.getEscapedString(cat.name)}','category nav');">
                                       <h:outputText value="#{cat.name} (#{cat.nrOfResults})"/>
                                       </h:outputLink></pre>
                                    <h:graphicImage width="175px" height="1px" value="/img/navsep.gif" /> 
                                 </h:column>                     
                            </rich:dataTable>
                        </div>
                    </h:form>
                        <ws:applicationList/>
                </ui:define>
            </ui:composition>
            

            Thanks for your help.