I just started out using JSF 2.0 but I found myself mixing JSF tags with standard HTML tag
to achieve the desired layout.
Although I am using the facelets to layout my pages, but I think I cant help but mix components.
<ui:define name="content">
<h:form>
<h:commandButton value="Search" action="#{myBean.handleSearch}"/>
<h:commandButton value="Reset" action="#{myBean.handleReset}"/>
<div>
<!-- Some JSF component -->
</div>
I have been thinking if I have been running into bad practice. Any source of info for this?
Thanks
This is not a bad practice. This is perfectly fine. The only reason to use a JSF component is to have access to it in the JSF component tree. It would be a more poor practice to use
<h:panelGroup layout="block">instead of<div>here. But if it was a container of which you’d like to ajax-update its content, then a<h:panelGroup id="foo" layout="block">would have been perfectly fine as would an ‘html5-friendly’<div jsf:id="foo">with thexmlns:jsf="http://xmlns.jcp.org/jsf"namespace.For a bit of history, you may find this useful: JSF vs HTML(JSP) for enterprise portals UI layer. Which one to Choose? and WHY?