我不认为这是 AJAX 的 JSF 问题,因为我只有一个表单。
我查看了有关 Ajax 和 JSF 渲染内容的线程,并尝试了多种解决方案,但都没有成功。
任何人都看到我可能很明显错过了什么:-)
谢谢
索引.xhtml
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Manual</title>
<h:outputStylesheet name="style.css" library="css" />
</h:head>
<h:body>
<div id="page">
<h:form id="myform">
<div class="header" >
<h:graphicImage library="img" name="Logo.gif" alt="Logo"/>
<h1>Manual</h1>
</div>
<div class="menu">
</div>
<div class="nav">
<h:outputText value="Navigation 1"/><br/>
<p:commandLink value="Chapter100" action="#{contentBean.BuildContent}" update="content" >
<f:ajax process="@this" render=":content" />
</p:commandLink>
<!-- Add NewLine between links -->
<h:outputText value=" " />
</div>
</h:form>
<div class="mycontent">
<h:panelGroup id="content">
<h:outputText value="#{contentBean.content}" >
</h:outputText>
</h:panelGroup>
</div>
</div>
</h:body>
</html>
豆
@ManagedBean(name="contentBean")
@ViewScoped
public class ContentBean implements Serializable{
private List<String> lTocInfo = new ArrayList();
private String content = "Steve Newer 002 Content";
public String getContent()
{
return content;
}
public void setContent(String content) {
this.content = content;
}
public void BuildContent() throws Exception
{
this.setContent("Steve made it back from database");
}
}