如何使用指定版本2.3的JSF Facet创建Eclipse动态Web项目?

时间:2018-04-22 15:45:02

标签: eclipse jsf

我正在使用Eclipse Oxygen 3.配置JavaServer Faces方面时,可以选择的最高版本号是2.2。告诉Eclipse我使用2.3版的正确方法是什么?

1 个答案:

答案 0 :(得分:5)

  

告诉Eclipse我使用的是2.3版本的正确方法是什么?

你做不到。您基本上需要将Eclipse升级到更新的版本。但由于它还没有,它在这里结束。

现在,只需选择2.2然后再编辑faces-config.xml以指定2.3。它如下:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
    version="2.3">

    <!-- Config here. -->
</faces-config>

基本上就是这样。这是因为Eclipse只是一个代码编辑器,JSF facet基本上指示Eclipse自动生成一些文件(例如faces-config.xml)并安装FacesServlet并将JSF特定的构建器和验证器添加到项目中。换句话说,即使使用JSF 2.2方面,您也可以在Eclipse中开发,构建和运行JSF 2.3项目。