Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

jsf - Change composite-component's namespace

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).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...