2 Replies Latest reply on Apr 3, 2013 1:55 PM by Lukas Camra

    JSF Doctype

    Lukas Camra Newbie

      Hi,

       

      I'm trying to migrate my Java EE 6 application to JBoss EAP 6.1 Alpha but I'm struggling with JSF pages. It seems that JSF doesn't put correct doctype to the page and thus browser will enter quirks mode.

       

      I'm not sure if it's an issue with JBoss EAP or Mojarra 2.1.18. So I'm posting here as well. You can reproduce it as follows:

       

      The template contains following code:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
           <h:head>
                <title>Java EE 6 Starter Application</title>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <h:outputStylesheet name="css/screen.css" />
           </h:head>
           <h:body>
                <div id="container">
                     <div id="content">
                          <ui:insert name="content">
                          [Template content will be inserted here]
                          </ui:insert>
                     </div>
                     <div id="footer">
                          <h:graphicImage value="/resources/gfx/logo.png" alt="Weld logo" />
                     <p>This project was generated from a Maven archetype from</p>
                     </div>
                </div>
           </h:body>
      </html>
      
      

       

      the page is defined as follows:

      <!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:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        template="/WEB-INF/templates/default.xhtml">
       <ui:define name="content">
           <h1>Welcome to JBoss AS 7!</h1>
           <p>You have successfully deployed a Java EE 6 web application on JBoss AS 7.</p>
           <h:form>
                <h:inputText value="#{dataStorage.value}" />
                <h:commandButton action="#{dataStorage.generateData()}" value="Generate data"/>
           </h:form>
           <h:form id="reg">
                <h:commandButton immediate="true" action="#{performanceTest.proceed()}" value="hit it" />
                <h:commandButton immediate="true" action="#{performanceTest.waitAMinute()}" value="sleep" />
           </h:form>
        </ui:define>
      </ui:composition>
      

       

      It will render:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      instead of

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

       

      I also tested with JBoss built of Mojarra 2.1.19 and it produced the same result. There used to be some issues with Doctype in Mojarra around version 2.1.14 but it should have been solved. So I'm not sure if it's Mojarra fault or not.