gpt4 book ai didi

netbeans - 使用 Netbeans 7.0.1、Maven 在 JSF2 中打包复合组件

转载 作者:行者123 更新时间:2023-12-01 12:58:24 26 4
gpt4 key购买 nike

我在 Internet 上阅读了很多关于将 JSF2 复合组件打包到 JAR 文件中的内容。

有人知道我在哪里可以找到 JAR 的结构(规范、官​​方文档等)。有没有办法用 Netbeans IDE 做到这一点,或者 Maven 是否存在原型(prototype)?

最佳答案

来自 JSF composite tag library documentation summary (强调我的):

Creating a Composite Component

The default implementation must support authoring. A composite component is declared by creating a Facelets2 file inside of a resource library. (See section JSF.2.6 of the specification prose document for more information about resource libraries.) A composite component must reside within a resource library. It is not possible to create a composite component without putting it inside of a resource library.



来自 the JSF specification 的第 2.6 节:

2.6.1.2 Packaging Resources into the Classpath

For the default implementation, resources packaged in the classpath must reside under the JAR entry name:

META-INF/resources/<resourceIdentifier>

Resources packaged into the classpath must be accessed using the getResource*() methods of the ClassLoader obtained by calling the getContextClassLoader() method of the current Thread.



言归正传,所有复合组件都必须进入 /META-INF/resources。 JAR 文件夹。它的处理方式与 /WEB-INF/resources 相同。在常规 WAR 中(因此您仍然需要一个额外的子文件夹来表示复合组件的主命名空间)。

对于这种情况,如果 JAR 还包含带有 JSF 注释的类,例如 @ManagedBean等等,那么 JAR 还必须具有与 JSF 2.0 兼容的 /META-INF/faces-config.xml文件,以触发 JSF 注释扫描器为实现任何 JSF 注释的类爬取整个 JAR。

至于 Netbeans/Maven 部分,对不起,我不知道,因为我不使用它们。

关于netbeans - 使用 Netbeans 7.0.1、Maven 在 JSF2 中打包复合组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8295935/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com