Friday, November 02, 2012

JSF 2.x Tip of the Day: <ui:fragment/> and Namespaces

A junior engineer lamented that he could not get NetBeans auto-completion to work, and that his xhtml pages were all red. He wished that NetBeans could be "smarter".

I told him it was "smarter", but he needed to show a little understanding. His problem was that he was using the <ui:fragment/> without namespaces defined.

So here is how you do it to avoid a sea of red. Notice how I just simply added the namespaces as attributes right to the <ui:fragment/>. No more red, and NetBeans is happy.