Last Updated: February 25, 2016
· steviebraga

JSF 2.2 Composite Components

Writing a composite component in JSF 2.2, I found myself facing with this ServletException:

Tag Library supports namespace:, but no tag was defined for name: myComponent

I wrote composite components before, but using JSF 2.1. In 2.2 there is small difference:


In 2.1 we just declared the regular namespace:


But in 2.2 we need to add the tag name to the url


Directory Structure

In 2.1 components need to be on this folder

webaap > resources > components > myComponent.xhtml

Now in 2.2 the components must be inside a folder named with the tag name

webaap > resources > custom > myComponent.xhtml

With this little changes the component started working alright:

<custom:myComponent> ... </custom:myComponent>