An HTML5 friendly markup
After Java EE 7 and the release of JSF 2.2, the framework always renders the HTML5 document type: <DOCTYPE html>
. This is the default behavior for the modern digital websites. With the HTML5 support, developers can just write the content in a Facelets view (a *.xhtml
file) that is compatible with the rendering engines in a modern web browser.
JSF 2.2 provides two types of attributes for the HTML elements: pass-through
attributes and pass-through
elements.
The pass-through attributes
The pass-through
attributes enable JSF to seamlessly support the new and extended attributes that are defined by the HTML5. These attributes are applicable to the JSF HTML render kit custom tags such as <h:inputText>
. In order to use the pass-through
attributes, we will define a JSF namespace at the top of the Facelets view that references the URL http://xmlns.jcp.org/jsf/passthrough.
Let's take an example that uses the HTML5 attributes for a placeholder text:
<html...