如何在 Eclipse 用户库中启用 JSF Facet
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须通过Window > 自行准备它们。首选项>爪哇>构建路径>用户库。。
当您选择此选项时,Eclispe 还会告诉我您认为用户有责任通过替代方式适当配置类路径。
这是替代方法之一。是否需要自己下载取决于项目的目标运行时。例如,如果它是一个不附带捆绑 JSF 的简单 JSP/Servlet 容器(例如 Tomcat 7),那么您确实需要自己安装它。只需将 JAR 放入
/WEB-INF/lib
中就足够了(当然,或者将其定义为用户库)。 Eclipse 将自动为您做正确的事情(添加到构建路径,包括导出的 WAR 等)。但是,如果它是一个更成熟的 Java EE 容器(例如 Glassfish 3),那么您不需要执行任何操作,因为它已经将 JSF 捆绑为 Java EE API 的一部分。只需完全禁用库配置即可。他们包含了 JSF 工具。但它们不包括 JSF 库。或者你读过其他内容吗?如果有的话,具体在哪里?这肯定是错误信息或误解。
另请参阅:
You have to prepare them yourself by Window > Preferences > Java > Build Path > User Libraries.
When you choose this option, Eclispe will also tell you that the user takes the responsibility of configuring the classpath appropriately via alternate means.
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.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:
下载 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