如何添加JSF实现库?

时间:2016-05-23 04:49:37

标签: eclipse jsf tomee

我正在使用TomEE。我的印象是TomEE已经拥有JSF IMplementation Libraries

因此,在创建Eclipse项目时,请按照文档并选择Library Provided By Target Runtime

enter image description here

它显示为this facet requires jsf implementation library to be present on project classpath. By disabling library configuration, user takes on responsibility of configuring classpath appropriately via alternate means

所以我继续添加TomEE ...\apache-tomee-webprofile-1.7.4\lib附带的所有捆绑罐子(包括myfaces-api-2.1.17.jarmyfaces-impl-2.1.17.jar

然后我Run on Server进行以下测试xhtml但它会呈现一个空白页。显然,xhtml未编译。因此捆绑的TomEE罐子没有开始。我怎样才能让那些捆绑的TomEE罐子编译我的测试xhtml

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:a="http://xmlns.jcp.org/jsf/passthrough">

    <h:head>
        <title>Hello World - Input Form</title>
    </h:head>
    <h:body>

        <h:form>
            <h:inputText id="name" value="#{theUserName}" 
                            a:placeholder="What's your name?" />

            <h:commandButton value="Submit" action="myresponse" />
        </h:form>

    </h:body>
</html>

1 个答案:

答案 0 :(得分:1)

TomEE在mymee / lib文件夹中将MyFaces作为JSF实现。更糟糕的情况是添加它引用myfaces-api,但确保在包装过程中不要把它放在战争中。