@Deprecated 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
: autocomplete
UISelectBoolean
, UISelectOne
and UISelectMany
: autofocus
HtmlInputText
: type
(supported values are text
(default), search
, email
, url
, tel
, range
, number
and date
)autofocus
list
pattern
placeholder
spellcheck
min
max
step
type
of range
, number
and date
)HtmlInputTextarea
: autofocus
maxlength
placeholder
spellcheck
wrap
HtmlInputSecret
: autofocus
pattern
placeholder
HtmlCommandButton
: autofocus
Note: the list
attribute expects a <datalist>
element which needs to be coded in
"plain vanilla" HTML (and is currently, July 2014, only supported in IE 10, Firefox 4, Chrome 20 and Opera 11). See
also HTML5 tutorial.
To use the HTML5 render kit, register it as follows in faces-config.xml
:
<factory> <render-kit-factory>org.omnifaces.renderkit.Html5RenderKitFactory</render-kit-factory> </factory>
You can also configure additional passthrough attributes via the
"org.omnifaces.HTML5_RENDER_KIT_PASSTHROUGH_ATTRIBUTES" context parameter in
web.xml
, 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>
Note that <f:ajax>
of Mojarra 2.0.0-2.1.13 explicitly checks for
<input type="text">
and ignores other types while preparing request parameters for ajax submit,
resulting in null
values in managed bean after an ajax submit. This has been reported as
Mojarra issue 2532 and is fixed in Mojarra 2.1.14.
This problem is thus completely unrelated to Html5RenderKit
.
Noted should be that JSF 2.2 will support defining custom attributes directly in the view via the new
http://xmlns.jcp.org/jsf/passthrough
namespace or the <f:passThroughAttribute>
tag.
<html ... xmlns:p="http://xmlns.jcp.org/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>
As per OmniFaces 2.2 (actually technically already since OmniFaces 2.0), this HTML5 render kit is deprecated. Users are encouraged to migrate to new JSF 2.2 support for passthrough attributes as described above. The HTML5 render kit is scheduled to be removed in a future OmniFaces 3.0 (for JSF 2.3).
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_NAME_PASSTHROUGH_ATTRIBUTES
Deprecated.
The context parameter name to specify additional passthrough attributes.
|
Constructor and Description |
---|
Html5RenderKit(RenderKit wrapped)
Deprecated.
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)
Deprecated.
Returns a new HTML5 response writer which in turn wraps the default response writer.
|
RenderKit |
getWrapped()
Deprecated.
|
addClientBehaviorRenderer, addRenderer, createResponseStream, getClientBehaviorRenderer, getClientBehaviorRendererTypes, getComponentFamilies, getRenderer, getRendererTypes, getResponseStateManager
public 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 RenderKitWrapper
public RenderKit getWrapped()
getWrapped
in interface FacesWrapper<RenderKit>
getWrapped
in class RenderKitWrapper
Copyright © 2012–2017 OmniFaces. All rights reserved.