1 Reply Latest reply on Sep 29, 2011 11:41 PM by mp911de

    Bad HTML Code generation

    djheath

      When I use facelets with RF 4.0, this is the HTML that gets generated:

       

      <!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" lang="en"><head>

      <link type="text/css" rel="stylesheet" href="/javax.faces.resource/theme.css.html?ln=primefaces-ui-lightness" />

       

       

      <script type="text/javascript" src="/javax.faces.resource/jsf.js.html?ln=javax.faces"></script><script type="text/javascript" src="/javax.faces.resource/jquery.js.html"></script><script type="text/javascript" src="/javax.faces.resource/richfaces.js.html"></script><script type="text/javascript" src="/javax.faces.resource/richfaces-queue.js.html"></script>

      <script type="text/javascript" src="/javax.faces.resource/richfaces-base-component.js.html"></script>

      <script type="text/javascript" src="/javax.faces.resource/poll.js.html?ln=org.richfaces"></script>

      <script type="text/javascript" src="/javax.faces.resource/popupPanel.js.html?ln=org.richfaces"></script>

      <script type="text/javascript" src="/javax.faces.resource/popupPanelBorders.js.html?ln=org.richfaces"></script>

       

       

      <script type="text/javascript" src="/javax.faces.resource/popupPanelSizer.js.html?ln=org.richfaces"></script>

      <script type="text/javascript" src="/javax.faces.resource/richfaces-event.js.html"></script>

      <link type="text/css" rel="stylesheet" href="/rfRes/popupPanel.ecss.html?db=eAFzc!iyGwAEfwI2&amp;ln=org.richfaces" />

      <link type="text/css" rel="stylesheet" href="/rfRes/msg.ecss.html?db=eAFzc!iyGwAEfwI2&amp;ln=org.richfaces" />

      <script type="text/javascript" src="/javax.faces.resource/message.js.html?ln=org.richfaces"></script>

                          <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

                          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                          <meta name="author" content="Aperto Informatics, LLC" />

                          <meta name="child care, daycare, toddler, tot, baby, infant, homecare provider, children, babies" content="tendingtots.com" />

                          <meta name="Description" content="Childcare management system for providers and parents of young children" />

       

       

                          <meta name="language" content="English" />

                          <title>Children's Activities at Heath Bar - TendingTots.com (logged in as dana.heath@gmail.com)</title>

                          <link rel="shortcut icon" type="image/x-icon" href="theme/orange-blue/logo16.png" />

                          <link rel="stylesheet" type="text/css" href="theme/orange-blue/css/style.css" />

       

      ...etc.

       

      Here's the layout template that does this:

       

      <!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:h="http://java.sun.com/jsf/html"

                xmlns:f="http://java.sun.com/jsf/core" lang="en">

                <f:loadBundle basename="com.aperto.baby.resources.en_US" var="msg"/>

                <h:head>

                          <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>

                          <meta name="language" content="English" />

                          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                          <meta name="author" content="Aperto Informatics, LLC" />

                          <meta name="child care, daycare, toddler, tot, baby, infant, homecare provider, children, babies" content="tendingtots.com" />

                          <meta name="Description" content="Childcare management system for providers and parents of young children" />

                          <title><ui:insert name="title"/>#{userBean.activeSite.label} - TendingTots.com (logged in as #{userBean.username})</title>

                          <link rel="shortcut icon" type="image/x-icon" href="theme/#{themeBean.theme}/logo16.png" />

                          <link rel="stylesheet" type="text/css" href="theme/#{themeBean.theme}/css/style.css" />

                </h:head>

                <f:view>

                          <ui:include src="header.xhtml"></ui:include>

                          <div id="wrapper">

                                    <ui:insert name="menu" />

                              <div class="content_top1">

                                <div class="title1"><ui:insert name="content-title"/></div>

                              </div>

                              <div id="content">

                                <div class="container">

                                  <div class="homepage_wrp">

                                              <ui:insert name="content" />

                                  </div>

                                </div>

                              </div>

                          </div>

                          <!--Footer Starts Here-->

                          <div id="footer">

                            <div class="container"> </div>

                          </div>

                          <!--Footer Ends Here-->

                  <h:inputHidden id="maximumSeverity" value="#{facesContext.maximumSeverity.ordinal}"/>

              </h:form>

                </f:view>

      </html>

       

      and one of the pages that uses the layout...

      <!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:a4j="http://richfaces.org/a4j"

                xmlns:rich="http://richfaces.org/rich"

                xmlns:h="http://java.sun.com/jsf/html" lang="en">

                <ui:composition template="theme/#{themeBean.theme}/layout.xhtml">

                          <ui:define name="title">Children's Activities at </ui:define>

                          <ui:define name="menu" >

                                    <ui:include src="shared/#{userBean.role}-menu.xhtml" />

                          </ui:define>

                          <ui:define name="content" >

                                    <ui:include src="shared/#{userBean.role}.xhtml" />

                          </ui:define>

                          <ui:define name="content-title">

                                    <a4j:outputPanel rendered="#{userBean.role ne 'ROLE_ADMIN'}">

                                    <img src="theme/#{themeBean.theme}/images/title_child_activities.png" alt="" width="131" height="34" />

                                    </a4j:outputPanel>

                                    <a4j:outputPanel rendered="#{userBean.role eq 'ROLE_ADMIN'}">

                                    <h:outputText styleClass="subheader" value="System Administration" />

                                    </a4j:outputPanel>

                          </ui:define>

                </ui:composition>

      </html>

       

      So... please tell me why richfaces generates script and link tags BEFORE the meta tags which should be first. This isn't just a cosmetic issue - for example, I'm setting the IE 8 compatibility mode but it won't apply because these other tags precede the meta information.

       

      Thanks in advance

        • 1. Re: Bad HTML Code generation
          mp911de

          Hi Dana,

          this happens, because JSF generates all the needed Header-Stuff first. In your special case you could move the "X-UA-Compatible" content="IE=EmulateIE8 to a real HTTP header (e.g. using a Servlet-Filter) which should solve your problem.

           

          Best regards,

          Mark