How to make Eclipse IDE supports JSF 2.0
In Eclipse Ganymede (v3.4) or Galileo (v3.5), it has supports for JSF 1.2 only. For JSF 2.0, it’s recommended to upgrade the Eclipse to the latest version, Helios (v3.6), it has full support of Java EE 6 support, including JSF 2.0.
Here’s a quick guide to show how to enable the JSF 2.0 features in Eclipse project.
1. Eclipse Helios
Download the latest Eclipse IDE for Java EE Developers, Helios (v3.6).
2. Project Facets
To support JSF 2.0, you have to configure your Eclipse project to support Web Tools Platform (WTP).
Steps to enable the Web Tools Platform (WTP) :
- Right click on the project, choose “properties” –> “Project Facets“.
- Check “Dynamic Web Module“, select version 2.5.
- Check “Java“, choose version 1.6.
- Check “JavaServer Faces“, choose version 2.0.

- Click on the “further configuration…” link below to do the JSF configuration.
- Create an user library and include the JSF 2.0 API and implementation libraries, jsf-api-xxx.jar and jsf-impl-xxx.jar.

- Done.
3. Demo
Now the Eclipse project is support the JSF 2.0 capabilities. In .xhtml file, click on the “Ctrl + Space“, it will prompts the JSF 2.0 tags (code assist) automatically. Furthermore, it add JSF 2.0 visual components to the web page editor as well.









[...] How to make Eclipse IDE supports JSF 2.0 – April 27th ( tags: javaserver faces jsf java eclipse howto guide tutorial setup example ) [...]
I have a question regarding mixing jsp for JSF 1.2 and xhtml for JSF 2.0 in a JSF 2.0 project.
We are using websphere. Is it possible to convert a project to use JSF 2.0 facets, but keep the original jsps that use IBM’s JWL and create new pages as JSF 2.0 xhtml pages and have both run within the same application within the same webapp?
Thanks
WebSphere.. Good Luck bro, i have too many bad experienced on it. Each WebSphere version have different implementation and NOT compatible to each other, make sure you consult the IBM documentation.
To be frankly, WebSphere is a IBM standard, not Java standard, what apply on standard Java App Server may fail on WebSphere. Often times, you need to “hack” something to get what you want.
Hi ,mkyong
I have followed the steps which you mentioned to configure eclipse Helios v3.6 and the tutorials work well but the JSF visual editor does not appear at all , so what to do to show the visual editor .
thank you .
Hi Mkyong, what about Eclipse Galileo, How can I make support JSF 2.0 jar?
Is above solution not working in your Galileo?
Most of the code are uncomplete : need to know how-to-update-row-in-jsf-datatable ?
Advanced thanks
Refer here – http://www.mkyong.com/tutorials/jsf-2-0-tutorials/ , find under jsf datatable section.
Never mind. I got it work. I had to uncheck the Dynamic Web Moudle and apply, change the version and re-check it.
Gang
Hi, mkyong,
I followed your steps to configure my eclipse-helio for JSF 2.0. But the IDE displays error, “Cannot change version of project facet Dynamic Web Module to 2.5″. It was originally “2.3″ and JavaServer Faces 2.0 requires 2.5. Any idea?
I created a Maven project using apache’s webapp architype.
Thanks,
Gang
Hi,
thanks for this very helpfull tutorial.
I have just one question regarding jsf 2.0 and css :
How to invoke an external stylesheet e.g. “layout.css” in my jsf 2.0 project.
I tried this :
…
…
Eclipse Helios says unknown Tag <h:outputStylesheet…
Do you have any idea \ suggestion how to fix this ?
Thanks in advance and best regards
Klaus
To include external CSS in JSF2, try following articles
http://www.mkyong.com/jsf2/how-to-include-cascading-style-sheets-css-in-jsf/
http://www.mkyong.com/jsf2/resources-library-in-jsf-2-0/
I guessed that the problem was with it being able to edit .xml configs. It seems that doing this on an existing project causes problems, but doing this with a brand new project is okay.
Must be an Eclipse bug…
What’s your Eclipse version?
Hi
When I enable the JSF facet, doing it exactly as described in your post, I get the following error:
Failed while installing JavaServer Faces 2.0
Reason:
‘myproject’ : unable to configure web module for JavaServer Faces