如何在 Eclipse 用户库中启用 JSF Facet

发布于 2024-12-15 23:16:21 字数 276 浏览 2 评论 0原文

我在 Eclipse 中启用 JSF 时遇到问题。我已经安装了应该包含 JSF 的 WPT 工具,但是当我右键单击我的项目、属性、方面、启用方面时,我收到一条警告,提示“需要进一步配置”,我单击此按钮,并收到通知“至少必须选择一个用户库”但是没有可供选择的库。

我可以选择“禁用库配置”,但我不知道这可能会产生什么影响,因为 Eclipse 告诉我必须配置用户库。

我应该从 Mojarra 下载一个单独的 Jar 并将其添加到我的构建中吗?或者我可以安全地禁用。为什么它没有像预期那样包含在 WTP 中?

I'm having troulbe enabling JSF in Eclipse. I have installed the WPT tools that should have had JSF included but when I right click on my project, properties, facets, enable facets I get a warning saying "Further configuration required" I click this, and I'm notified that "At least one user library must be selected" However there are no libraries to select.

I can optionally select "Disable Library Configuration" but I don't know what effects this might have as Eclipse is telling me that i must configure a user library.

Should I download a separate Jar from the Mojarra and add this to my build? Or can I safely disable. Why wasn't it included with WTP like it was supposed to be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨小墨 2024-12-22 23:16:21

“必须至少选择一个用户库”,但是没有可供选择的库。

您必须通过Window > 自行准备它们。首选项>爪哇>构建路径>用户库。


我可以选择“禁用库配置”,但我不知道这可能会产生什么影响,因为 Eclipse 告诉我必须配置用户库。

当您选择此选项时,Eclispe 还会告诉我您认为用户有责任通过替代方式适当配置类路径。


我应该从 Mojarra 下载一个单独的 Jar 并将其添加到我的构建中吗?或者我可以安全地禁用。

这是替代方法之一。是否需要自己下载取决于项目的目标运行时。例如,如果它是一个不附带捆绑 JSF 的简单 JSP/Servlet 容器(例如 Tomcat 7),那么您确实需要自己安装它。只需将 JAR 放入 /WEB-INF/lib 中就足够了(当然,或者将其定义为用户库)。 Eclipse 将自动为您做正确的事情(添加到构建路径,包括导出的 WAR 等)。但是,如果它是一个更成熟的 Java EE 容器(例如 Glassfish 3),那么您不需要执行任何操作,因为它已经将 JSF 捆绑为 Java EE API 的一部分。只需完全禁用库配置即可。


为什么它没有像预期那样包含在 WTP 中?

他们包含了 JSF 工具。但它们不包括 JSF 库。或者你读过其他内容吗?如果有的话,具体在哪里?这肯定是错误信息或误解。


另请参阅:

"At least one user library must be selected" However there are no libraries to select.

You have to prepare them yourself by Window > Preferences > Java > Build Path > User Libraries.


I can optionally select "Disable Library Configuration" but I don't know what effects this might have as Eclipse is telling me that i must configure a user library.

When you choose this option, Eclispe will also tell you that the user takes the responsibility of configuring the classpath appropriately via alternate means.


Should I download a separate Jar from the Mojarra and add this to my build? Or can I safely disable.

That's one of the alternative ways. Whether you need to download it yourself depends on the project's target runtime. If it's for example a simple JSP/Servlet container which does not ship with bundled JSF, such as Tomcat 7, then you indeed need to install it yourself. Just dropping the JAR(s) in /WEB-INF/lib is sufficient (or defining it as an user library, of course). Eclipse will automagically do the right things for you (adding to build path, including in exported WAR, etc). However, if it's for example a more full fledged Java EE container, such as Glassfish 3, then you don't need to do anything as it already bundles JSF as part of Java EE API. Just disable the library configuration altogether.


Why wasn't it included with WTP like it was supposed to be?

They have JSF tools included. They do however not include JSF libraries. Or did you read otherwise? If so, where exactly? It must have been a misinformation or misinterpretation.


See also:

凑诗 2024-12-22 23:16:21

下载 javax.faces-2.1.17.jar 文件并通过管理库选项创建一个新库,并将 jar 文件添加到该库中。点击应用,现在就可以使用了

Download javax.faces-2.1.17.jar file and create a new library from manage library option and add the jar file in that library. Click apply, now it will work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文