更改Composite-Component的名称空间 [英] Change composite-component's namespace

查看:75
本文介绍了更改Composite-Component的名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型图书馆(JAR),其中包含一些自定义JSF组件.其中一些是复合组件,这些组件完全(或部分)在XHTML文件中实现,这些文件位于 META-INF/resources/my-components 下.要使用其他XHTML文件中的这些组件,我必须使用XML命名空间 http://xmlns.jcp.org/jsf/composite/my-components .

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.

该库中的其他相关组件使用 @FacesComponent (和 @FacesRenderer )实现为POJO.要使用这些组件,我必须使用XML命名空间,该命名空间是在组件的 @FacesComponent -注释(属性 namespace )处定义的.此时,我可以选择所需的任何内容(例如 http://my-company.com/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).

由于我尚未发现更改复合组件的名称空间前缀的任何可能性,并且我不想将POJO的名称空间设置为类似 jcp.org 的名称(我不确定如果可能的话),我必须使用两个不同的名称空间来使用来自同一库的组件.

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.

问题是:是否可以为我的复合组件指定完整的名称空间?当然,我想使用与其他组件相同的组件(示例中为 http://my-company.com/my-components ).

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

推荐答案

只需在名称空间声明下方的 *.taglib.xml 文件中指定组合库名称.

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>

这篇关于更改Composite-Component的名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆