Change composite-component's namespace

会有一股神秘感。 提交于 2019-12-29 09:18:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!