How to Enable the JSF facet in eclipse user library

萝らか妹 提交于 2019-12-11 08:45:26

问题


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?


回答1:


"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:

  • JSF 2.0 tutorial with Eclipse and Glassfish



回答2:


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



来源:https://stackoverflow.com/questions/8145364/how-to-enable-the-jsf-facet-in-eclipse-user-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!