Change composite-component's namespace
Asked Answered
L

1

3

I have a small library (JAR) containing some custom JSF-components. Some of them are composite-components which are completely (or partly) implemented in XHTML files which reside under META-INF/resources/my-components. To use these components from other XHTML-files I have to use the XML-namespace http://xmlns.jcp.org/jsf/composite/my-components.

Other related components in this library are implemented as POJOs using @FacesComponent (and @FacesRenderer). To use these components, I have to use the XML-namespace which is defined at the component's @FacesComponent-annotation (attribute namespace). At this point I can choose whatever I want (like http://my-company.com/my-components).

Since I have not found any possibility to change the namespace-prefix of my composite components, and I do not want to set my POJO's namespace to something like jcp.org (I'm not sure if this is even possible), I have to use two different namespaces to use my components coming from the same library.

But since the namespaces are different only because of an implementation-detail and maybe one component will be realized in a different way in the future, this is not what I want.

So the question is: is there a way to specify the full namespace for my composite-components? Of course, I want to use the same ones which are used for my other components (http://my-company.com/my-components in the example).

Lanthanum answered 7/3, 2014 at 10:45 Comment(0)
C
2

Just specify the composite library name in your *.taglib.xml file, below the namespace declaration.

<namespace>http://my-company.com/my-components</namespace>
<composite-library-name>my-components</composite-library-name>
Captive answered 7/3, 2014 at 11:23 Comment(1)
Thanks! I just hat to add all existing tags to the taglib, which have been created automatically before (using @FacesComponent(createTag=true, ...)). But it works as expected and I can use a common namespace.Lanthanum

© 2022 - 2024 — McMap. All rights reserved.