7 Replies Latest reply on Jan 14, 2011 9:13 AM by nimo stephan

    the future of xhtml and jsf

    nimo stephan Master

      I red this http://webdesign.about.com/b/2009/07/06/goodbye-xhtml-hello-html-5.htm

      and this http://www.w3.org/2009/06/xhtml-faq.html

      and I am wondering how JSF will overcome this fact.

      It sounds that the work on XHTML2 is stopped and will not come in future.

       

      JSF and therefore Richfaces relys on .xhtml-files and not on .html-files.

      So how can I use, for example, the new html5-tags in a strict xhtml1-page ?

      I know, I can use X/HTML5 (which subsumed XHTML), but then I have to rename .xhtml to .html, am I right?

       


        • 1. the future of xhtml and jsf
          Ilya Sorokoumov Master

          J2EE 6 has declared Facelets as part of JSF 2.0 and Facelets technology is really based on xhtml. But in my opinion everything is changing and J2EE 7 will solve any problems with xhtml if there would be any problems of course.

           

          P.S. I don't think that pages prefix is a problem. We alway can use DEFAULT_SUFFIX in order :

          For instance I used jspx instead of xhtml several times and it wasn't a problem for JSF.

            <context-param>  

                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>  

                <param-value>.jspx</param-value>  

            </context-param>

          • 2. Re: the future of xhtml and jsf
            nimo stephan Master

            Yes, indeed, everything is changing;)

             

            I am only in doubt, all facelets-templates use something like 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">
              <head>
                <title>Page title goes here</title>
              </head>
              <body>
                <!-- content goes here -->
              </body>
            </html>

            and save it as example.xhtml.

            Because the xhtml-document is marked as Transitional, the browser will display it in "quirks"/"non-standards" mode.

            I am only unsecure about 4 things:

            1. The MIME-Type is not explicitly defined, so I assume that the browser would assume application/xml+xhtml and NOT

            text/html. Am I right?

             

             

            2. If I were to declare the MIME-Type explicitly:

            <html xmlns="http://www.w3.org/1999/xhtml" >

            <head>

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

            ..

             

            and save it as example.xhtml, then this document is treated as a HTML 4 instead of XHTML 1. Am I right?

             

             

            3. If I were to define this template as follows:

             

            <!DOCTYPE html>

            <html xmlns="http://www.w3.org/1999/xhtml">

              <head>

                <title>Page title goes here</title>

              </head>

              <body>

                <!-- content goes here -->

              </body>

            </html>

             

            and save it as example.xhtml, then this document is treated as a HTML5-Document. Am I right?

             

            4. If I were to leave to Doctype in the jsf-page, what would be the default?


            • 3. Re: the future of xhtml and jsf
              Ilya Sorokoumov Master

              I guess we should think about xhtml before JSF rendering and after JSF rendering separately. The first is not supposed to be open in browser and we should use IDE instead. And the second can be changed by JSF however it wants. Thus there can be a lot of tricks so that JSF can transform our xhtml page to something we want it to be. I think even if it's not real right now it will become possible in future JSF releases. Thus we will be able to have xhtml pages in project and JSF will transform them to html/xml/etc whatever we need. =)

              • 4. the future of xhtml and jsf
                Nick Belaevski Master

                Hi,

                nimo stephan wrote:

                 

                JSF and therefore Richfaces relys on .xhtml-files and not on .html-files.

                So how can I use, for example, the new html5-tags in a strict xhtml1-page ?

                I know, I can use X/HTML5 (which subsumed XHTML), but then I have to rename .xhtml to .html, am I right?

                On the server you can use any extension you like (e.g. .xml) - this is customizable in web.xml.

                 

                nimo stephan wrote:

                 

                I am only in doubt, all facelets-templates use something like 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">
                  <head>
                    <title>Page title goes here</title>
                  </head>
                  <body>
                    <!-- content goes here -->
                  </body>
                </html>

                and save it as example.xhtml.

                Because the xhtml-document is marked as Transitional, the browser will display it in "quirks"/"non-standards" mode.

                This is not a quirks, but almost standards/limited quirks mode: http://hsivonen.iki.fi/doctype/

                 

                nimo stephan wrote:

                 

                1. The MIME-Type is not explicitly defined, so I assume that the browser would assume application/xml+xhtml and NOT

                text/html. Am I right?

                Browser also sends a list of accepted types, so server does negotiation. For example, Facelets 1.x preferred to use xHTML, but as IE doesn't understand it, HTML was used instead. To see this in action, just check HTTP request/response headers for common request.

                 

                 

                nimo stephan wrote:

                 

                2. If I were to declare the MIME-Type explicitly:

                <html xmlns="http://www.w3.org/1999/xhtml" >

                <head>

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

                ..

                 

                and save it as example.xhtml, then this document is treated as a HTML 4 instead of XHTML 1. Am I right?

                 

                Server provides content-type in response headers, so you can control this via <f:view contentType="text/html"> or by using implementation-specific parameters (e.g. com.sun.faces.preferXHTML)

                 

                 

                nimo stephan wrote:

                 

                3. If I were to define this template as follows:

                 

                <!DOCTYPE html>

                <html xmlns="http://www.w3.org/1999/xhtml">

                  <head>

                    <title>Page title goes here</title>

                  </head>

                  <body>

                    <!-- content goes here -->

                  </body>

                </html>

                 

                and save it as example.xhtml, then this document is treated as a HTML5-Document. Am I right?

                 

                Why use 'xmlns' then? Anyway, HTML 5 specification states this is correct to use '<!DOCTYPE html>'.

                • 5. Re: the future of xhtml and jsf
                  nimo stephan Master

                  thank you, this helped me and I have 4 questions:

                   

                   

                  Question 1:


                  http://hsivonen.iki.fi/doctype/ states this out:

                  I am not recommending any of the XHTML doctypes, because servingXHTML as text/html is considered harmful. If you choose to use an XHTML doctype anyway, please note that the XML declaration makes IE 6 (but not IE 7!) trigger the Quirks mode.

                  By the way, I find out, that all rf-tools-facelets-templates uses text/html with xhtml-doctypes (xhtml1) instead of text/html with html-doctypes (html4/html5). So in future, I will no more use xhtml-doctypes as it is bad practice, I should use html4 or html5-doctype in JSF-Pages, am I right?

                   

                  Question 2:


                  All the rf-examples uses xhtml-files with doctype xhtml1 instead of xhtml-files with doctype html4. Why not using html doctype?

                   

                   

                  Question 3:


                  Does rf4 internally makes use of any HTML5-tags or CSS3-Properties to implement its futures ?

                   

                   

                  Question 4:

                   

                  I have a file on the server called test.xhtml (in which I integrate jsf2/rf4) and want to make use of html5-tags,

                  so I only need to do the following settings:

                   

                  1. Declare the following doctype for my test.xhtml

                  (I declare the doctype as html and do not use xhtml-namespaces and save this on the server as *.xhtml-file):

                   

                  <!DOCTYPE html>

                    <head>

                      <title>Page title goes here</title>

                    </head>

                    <body>

                      <!-- use any html5-tag -->

                     <audio>..</audio>

                    </body>

                  </html>

                   

                   

                  2. serve text.xhtml to the client as test.html:

                   

                  I serve my xhtml-file to the client with an html-prefix so the client (the browser) handles it as an *.html-file)

                   

                  <!-- Tell the context which URLs to process as facelets.  -->

                  <servlet-mapping>

                      <servlet-name>Faces Servlet</servlet-name>

                      <url-pattern>*.html</url-pattern>

                  </servlet-mapping>

                   

                  More is not to do, am I right ?

                  • 6. Re: the future of xhtml and jsf
                    Nick Belaevski Master

                    That's a question to tools being used, not Faceletes input file format. You can use *.jsf mapping and still have HTML5. If you want to force 'text/html', use <f:view contentType="text/html">. Check this also: http://stackoverflow.com/questions/2935759/is-it-possible-to-use-jsffacelets-with-html-4-5

                    Another quesion is:

                    Does rf4 internally makes use of any HTML5-tags or CSS3-Properties to implement its futures ?

                    We support IE 7+, so we have to either use minimal supported subset of HTML/CSS or provide some emulation for the missing features. Also IIRC not all HTML5 elements can be updated by JSF AJAX safely.