How to make Eclipse IDE supports JSF 2.0

来源:互联网 发布:爱普生r230清零软件 编辑:程序博客网 时间:2024/06/05 08:48

In Eclipse Ganymede (v3.4) or Galileo (v3.5), it supports until JSF 1.2 only. For JSF 2.0, upgrade your Eclipse to version Helios (v3.6) onward, it has full support of Java EE 6 support, including JSF 2.0.

Here’s a quick guide to show you how to enable JSF 2.0 features like code assist and visual JSF component editor in Eclipse IDE.

Tools Used

  • Eclipse 3.6
  • JSF 2.0.x

1. Eclipse Project Facets

To support JSF 2.0, you need to configure 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.
    eclipse-jsf-support
  • 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.

    P.S You can get the JSF jars official JSF website.

    eclipse-jsf-support

    Updated on 8 Aug 2012
    For JSF 2.1.11, only one jar file javax.faces-2.1.11 is required.
    Done.

2. Demo

Now, Eclipse IDE is supporting the JSF 2.0 capabilities. Try it, in .xhtml file, click on the “Ctrl + Space“, it will prompts all available JSF 2.0 tags (code assist) automatically.

Furthermore, it add JSF 2.0 visual components to the web page editor as well, see figure below :
eclipse-jsf-support

0 0
原创粉丝点击