jsfconvertersjsf-2.2passthrough-elements

Converter for JSF passthrough input element ("HTML5 friendly markup")


I'm using a passthrough element inside Facelet page like this:

<input jsf:value="#{...}"/>

And I'd like to attach a Converter to it. How can I achieve this?


Solution

  • Just the same way as when you would be using a normal JSF <h:inputText> component instead of plain HTML, with either the converter attribute

    <input jsf:value="#{...}" jsf:converter="fooConverter" />
    

    or the <f:converter> tag.

    <input jsf:value="#{...}">
        <f:converter converterId="fooConverter" />
    </input>
    

    Table 8-4 of the Java EE 7 tutorial lists which JSF component the given passthrough element will ultimately be converted to, before insertion in the JSF component tree. The Facelets VDL lists all available tags+attributes for those JSF components.