Custom HTML tag attributes are not rendered by JSF -
i want add ios specific tag attributes login-form. if have on web page source, attributes autocorrect, autocapitalize , spellcheck aren't there. reason this? using jsf 2.x.
<h:inputtext id="user-name" forceid="true" value="#{login.username}" style="width:120px;" autocorrect="off" autocapitalize="off" spellcheck="false" />
this design. can specify attributes supported jsf component (i.e. it's listed in attribute list in tag documentation). can't specify arbitrary additional attributes, plain ignored.
there several ways solve this:
if you're on jsf 2.2+, specify passthrough attribute:
<html ... xmlns:a="http://xmlns.jcp.org/jsf/passthrough"> ... <h:inputtext ... a:autocorrect="off" />
(note i'm using
xmlns:a
instead ofxmlns:p
avoid clash primefaces default namespace)or:
<html ... xmlns:f="http://xmlns.jcp.org/jsf/core"> ... <h:inputtext ...> <f:passthroughattribute name="autocorrect" value="off" /> </h:inputtext>
use omnifaces
html5renderkit
. since 1.5 release, supports specifying custom attributes<context-param>
. see showcase example or javadoc.create custom renderer. can find several concrete examples in below answers:
Comments
Post a Comment