Paul Waldo
Paul Waldo

Reputation: 1233

Integrating JSF 2 and JQuery Mobile

I'm trying to take an existing JSF 2 page and style it using JQuery Mobile (JQM). The problem is that JSF won't handle some of the JQM attributes. For example, I want to create a JQM-styled search input:

<input type="search" name="search" id="search" />

In order for this to be integrated with the JSF page, I have tried this:

<h:inputText type="search" name="search" id="search" value="#{bean.searchText}"/>

JSF does not accept a type attribute, so the rendered HTML looks like this:

<input type="text" name="search" id="search" />

This does not produce the proper JQM search widget :-(

I've googled for hours and have not found any examples of the integration of the two. Any ideas on how to make JQM and JSF play nicely? Thanks in advance!

Upvotes: 0

Views: 2401

Answers (2)

Dean
Dean

Reputation: 1

You can use jQuery or javascript to add attributes after the page is rendered.

Upvotes: 0

Daniel
Daniel

Reputation: 37061

"To overcome this, you would need to create a custom component or, better, just a custom renderer which overrides the standard <h:inputText> renderer and takes the custom attributes into account."

Take a look at BalusC complete explanation and suggested solution over here : JSF 2.0 strips out needed HTML5 attributes

Upvotes: 1

Related Questions