我尝试在Eclipse中使用一个简单的JSF2应用程序。 我有一个非常简单的ManagedBean(调用HelloBean.java)JSF2 + Eclipse + Glassfish奇怪的输出问题
package server;
@ManagedBean
@RequestScoped
public class HelloBean {
private String name;
public HelloBean() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
,这是我的index.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head><title>JSF 2.0 Hello World</title></h:head>
<h:form>
<h:inputText value="#{helloBean.name}"></h:inputText>
<h:commandButton value="Welcome me" action="welcome"></h:commandButton>
</h:form>
</html>
在Eclipse中我创建了一个名为JSF2.0的用户库,并添加了JSF -api ...和jsf-impl jar。在项目设置中,我选择了JavaServer Faces。 当我发布这个非常虚拟的应用程序,并检查浏览器时,我看到一个完全空白的页面。 只有标题可以,但其余内容不会显示。
我检查了服务器日志文件,没有警告没有错误,它看起来没问题。
有什么问题?我错过重要的事情吗?
感谢您的帮助!
你在导入什么或ManagedBean和RequestScoped。确保它们在JSF包装中,而不是CDI中。同时将你的脸部servlet映射到.jsf –