JSF2:如何在jsf-impl.jar中发现* .taglib.xml文件? [英] JSF2: How are the *.taglib.xml files discovered in jsf-impl.jar?

查看:54
本文介绍了JSF2:如何在jsf-impl.jar中发现* .taglib.xml文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jsf-impl.jar中(可以在 mvnrepository.com ),*.taglib.xml文件位于目录com/sun/faces/metadata/taglib/中.

In jsf-impl.jar (which can be found on mvnrepository.com), the *.taglib.xml files are located in directory com/sun/faces/metadata/taglib/.

在这种情况下,我不知道如何找到它们,因为 JSF 2规范说:

I don't understand how they're discovered in this case, because chapter 10.3.2 of the JSF 2 specification says:

10.3.2 Facelet标签库机制

...

10.3.2 Facelet Tag Library mechanism

...

运行时必须支持Facelet标记库描述符的两种发现模式

The run time must support two modes of discovery for Facelet tag library descriptors

    如第11.1.3节应用程序配置参数"中所述,
  • 在web.xml中的通过声明

  • Via declaration in the web.xml, as specified in Section 11.1.3 "Application Configuration Parameters"

通过以下方式自动发现:将标记库描述符文件放在Web应用程序类路径上的jar中,命名该文件,使其以.taglib.xml结尾(不带引号),然后将该文件放置在中目录中 jar文件.

Via auto discovery by placing the tag library descriptor file within a jar on the web application classpath, naming the file so that it ends with ".taglib.xml", without the quotes, and placing the file in the META-INF directory in the jar file.

...

在这里,它们不在目录META-INF中,那么它如何工作?

Here, they're not located in directory META-INF, so how does it work?

注意:在META-INF中,它们是一些.tld文件,但是我对它们不感兴趣,因为我没有使用JSP作为视图,而是使用Facelets.

Note: in META-INF, they are some .tld files, but I'm not interested in them since I'm not using JSP as the view, but Facelets.

推荐答案

它没有使用taglib.xml.它通过 com.sun.faces.facelets.tag.jsf.html.HtmlLibrary 在启动期间执行的.sun.faces/jsf-impl/2.2.1/com/sun/faces/application/ApplicationAssociate.java#ApplicationAssociate"rel =" nofollow> com.sun.faces.application.ApplicationAssociate .以下是Mojarra 2.2.1中的相关内容(复制自

It isn't using the taglib.xml for that. It's programmatically registering them via com.sun.faces.facelets.tag.jsf.html.HtmlLibrary in com.sun.faces.application.ApplicationAssociate which is executed during startup. Here are the relevant lines from Mojarra 2.2.1 (copypasted from Grepcode):

954        c.addTagLibrary(new CoreLibrary());
955        c.addTagLibrary(new CoreLibrary(CoreLibrary.XMLNSNamespace));
956        c.addTagLibrary(new HtmlLibrary());
957        c.addTagLibrary(new HtmlLibrary(HtmlLibrary.XMLNSNamespace));
958        c.addTagLibrary(new UILibrary());
959        c.addTagLibrary(new UILibrary(UILibrary.XMLNSNamespace));
960        c.addTagLibrary(new JstlCoreLibrary());
961        c.addTagLibrary(new JstlCoreLibrary(JstlCoreLibrary.IncorrectNamespace));
962        c.addTagLibrary(new JstlCoreLibrary(JstlCoreLibrary.XMLNSNamespace));
963        c.addTagLibrary(new PassThroughAttributeLibrary());
964        c.addTagLibrary(new PassThroughElementLibrary());
965        c.addTagLibrary(new FunctionLibrary(JstlFunction.class, FunctionLibrary.Namespace));
966        c.addTagLibrary(new FunctionLibrary(JstlFunction.class, FunctionLibrary.XMLNSNamespace));
967        if (isDevModeEnabled()) {
968            c.addTagLibrary(new FunctionLibrary(DevTools.class, DevTools.Namespace));
969            c.addTagLibrary(new FunctionLibrary(DevTools.class, DevTools.NewNamespace));
970        }
971        c.addTagLibrary(new CompositeLibrary());
972        c.addTagLibrary(new CompositeLibrary(CompositeLibrary.XMLNSNamespace));

这篇关于JSF2:如何在jsf-impl.jar中发现* .taglib.xml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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