DA.
DA.

Reputation: 40691

Having JSF spit out an HTML Search field. Doable?

I'm not a Java developer, but work with a team that is using JSF 1.2

We'd like to start using HTML 5 tags and attributes. It does not appear that JSF 1.2 supports those by default.

Is there anyway to have a JSF text tag:

<x:inputText>

spit out an html 5 search tag:

<input type="search" placeholder="blahblah" />

Right now, I'm having to let it output a regular text field and then I place inline JS after it to trigger a function that converts it client side:

<input type="text">
<script> funciton here that changes type to 'search' and adds placeholder attribute</script>

It works, but is a bit hacky. Is there a legitimate way to get server-side JSF to output proper HTML 5 tags?

Upvotes: 2

Views: 488

Answers (1)

BalusC
BalusC

Reputation: 1109422

Create a custom component. This allows you fine grained control over rendered HTML.

Or upgrade to JSF 2.0, then you can create a composite component which is a lot easier.

Upvotes: 2

Related Questions