Jsf 2 ajax代码在带有jsf和maven的eclipse中不起作用
这是我的Bean类,我在pom.xml中使用xhtml并使用maven所有必需的jarJsf 2 ajax代码在带有jsf和maven的eclipse中不起作用,jsf-2,maven-2,Jsf 2,Maven 2,这是我的Bean类,我在pom.xml中使用xhtml并使用maven所有必需的jar @ManagedBean @SessionScoped public class HelloBean implements Serializable { private static final long serialVersionUID = 1L; private String name; public String getName() { return name; } public voi
@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSayWelcome(){
//check if null?
if("".equals(name) || name ==null){
return "";
}else{
return "Ajax message : Welcome " + name;
}
}
}
这是我的helloAjax.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:body>
<h3>JSF 2.0 + Ajax Hello World Example</h3>
<h:form>
<h:inputText id="name" value="#{helloBean.name}"></h:inputText>
<h:commandButton value="Welcome Me">
<f:ajax execute="name" render="output" />
</h:commandButton>
<h2><h:outputText id="output" value="#{helloBean.sayWelcome}" /></h2>
</h:form>
</h:body>
</html>
JSF2.0+Ajax Hello World示例
但是在运行了这个页面之后,我在输出中只得到了标题,并且在pom.xml中使用了JSFAPI和jsf imple
请引导我