问题
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).
回答1:
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>
来源:https://stackoverflow.com/questions/22247914/change-composite-components-namespace