h:outputLabel with "for" attribute renders a HTML label with "for". If user click on the label the corresponding component - input, checkbox, radio button, etc. gets focus or gets selected.
If we use PrimeFaces components like p:calendar, p:spinner, p:autoComplete, ... the rendered markup has following structure (using example of calendar):
Code: Select all
JSF
<h:outputLabel for="calendarID" value="..."/>
<p:calendar id="calendarID" .../>
HTML
<div id="calendarID" ...>
<input id="calendarID_input" ...>
<img .../>
</div>
Code: Select all
<h:outputLabel for="calendarID_input" value="..."/>
<p:calendar id="calendarID" .../>
The question is now would be not better to create UIInput, populate with data, add to the tree and let it render? The second better solution would be to render
Code: Select all
<div id="calendarID_container" ...>
<input id="calendarID" ...>
<img .../>
</div>
What do you think?