public class Html5RenderKit extends RenderKitWrapper
This HTML5 render kit adds support for HTML5 specific attributes which are unsupported by the JSF UIForm,
UIInput and UICommand components. So far in JSF 2.0 and 2.1 only the autocomplete
attribute is supported in UIInput components. All other attributes are by design ignored by the JSF standard
HTML render kit. This HTML5 render kit supports the following HTML5 specific attributes:
UIForm: autocompleteUISelectBoolean, UISelectOne and UISelectMany:
autofocusHtmlInputTextarea: autofocusmaxlengthplaceholderspellcheckwrapHtmlInputText: type (supported values are
text (default), search, email, url, tel,
range, number and date)autofocuslistpatternplaceholderspellcheck
minmaxsteptype of range, number and date)HtmlInputSecret: autofocuspattern
placeholderHtmlCommandButton: autofocus
Note: the list attribute expects a <datalist> element which needs to be coded in
"plain vanilla" HTML (and is currently, June 2012, only supported in Firefox 4 and Opera 11). See also
HTML5 tutorial.
Refer the documentation of Html5RenderKitFactory how to setup it.
You can also configure additional passthrough attributes via the
"org.omnifaces.HTML5_RENDER_KIT_PASSTHROUGH_ATTRIBUTES" context parameter, wherein the
passthrough attributes are been specified in semicolon-separated
com.example.SomeComponent=attr1,attr2,attr3 key=value pairs. The key represents the fully qualified
name of a class whose Class.isInstance(Object) must return true for the particular component
and the value represents the commaseparated string of names of passthrough attributes. Here's an example:
<context-param>
<param-name>org.omnifaces.HTML5_RENDER_KIT_PASSTHROUGH_ATTRIBUTES</param-name>
<param-value>
javax.faces.component.UIInput=x-webkit-speech,x-webkit-grammar;
javax.faces.component.UIComponent=contenteditable,draggable
</param-value>
</context-param>
Noted should be that JSF 2.2 will support defining custom attributes directly in the view via the new
http://java.sun.com/jsf/passthrough namespace or the <f:passThroughAttribute> tag.
<html ... xmlns:p="http://java.sun.com/jsf/passthrough"> ... <h:inputText ... p:autofocus="true" />(you may want to use
a instead of p as namespace prefix to avoid clash with PrimeFaces
default namespace)
Or:
<h:inputText ...> <f:passThroughAttribute name="autofocus" value="true" /> </h:inputText>
| Modifier and Type | Field and Description |
|---|---|
static String |
PARAM_NAME_PASSTHROUGH_ATTRIBUTES
The context parameter name to specify additional passthrough attributes.
|
| Constructor and Description |
|---|
Html5RenderKit(RenderKit wrapped)
Construct a new HTML5 render kit around the given wrapped render kit.
|
| Modifier and Type | Method and Description |
|---|---|
ResponseWriter |
createResponseWriter(Writer writer,
String contentTypeList,
String characterEncoding)
Returns a new HTML5 response writer which in turn wraps the default response writer.
|
RenderKit |
getWrapped() |
addClientBehaviorRenderer, addRenderer, createResponseStream, getClientBehaviorRenderer, getClientBehaviorRendererTypes, getComponentFamilies, getRenderer, getRendererTypes, getResponseStateManagerpublic static final String PARAM_NAME_PASSTHROUGH_ATTRIBUTES
public Html5RenderKit(RenderKit wrapped)
wrapped - The wrapped render kit.public ResponseWriter createResponseWriter(Writer writer, String contentTypeList, String characterEncoding)
createResponseWriter in class RenderKitWrapperpublic RenderKit getWrapped()
getWrapped in interface FacesWrapper<RenderKit>getWrapped in class RenderKitWrapper