【发布时间】:2016-05-23 04:49:37
【问题描述】:
我正在使用 TomEE。我的印象是 TomEE 已经有了JSF IMplementation Libraries。
所以在创建Eclipse项目时,我按照文档选择Library Provided By Target Runtime
上面写着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 附带的所有捆绑 jar(这包括 myfaces-api-2.1.17.jar 和 myfaces-impl-2.1.17.jar)
然后我Run on Server下面的测试xhtml。 但它会呈现一个空白页面。显然,xhtml 没有被编译。所以捆绑的 TomEE jar 没有启动。我怎样才能让那些捆绑的 TomEE jar 编译我的测试 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>
【问题讨论】:
-
你自己说,TomEE已经提供了JSF库,为什么还要选择“用户库”而不是“Target Runtime提供的库”?
-
@BalusC 因为 Eclipse 不会编译
xhtml,除非我下载JSF库 -
我添加了详细的解释。我知道测试 xhtml 根本没有编译。
JSF标记未正确解释。这只有在JSF库没有解释标签时才会发生 -
您的空白页问题在这里得到解答了吗? stackoverflow.com/q/3112946 如果未找到 JSF 库,您将在 FacesServlet 上获得 ClassNotFoundException,而 webapp 部署将完全阻塞。
-
@BalusC 非常感谢。正如你所说,答案就在那里
change the <url-pattern> from /faces/* to *.xhtml
标签: eclipse jsf apache-tomee