Jsf 2 Richfaces轮询失败
通过ajax进行更新似乎效果不错,但我无法让richfaces轮询正常工作。确切地说:id为someoutput2的输出元素在1000毫秒后不会被a4j:poll元素更新 以下是页面代码:Jsf 2 Richfaces轮询失败,jsf-2,richfaces,facelets,polling,Jsf 2,Richfaces,Facelets,Polling,通过ajax进行更新似乎效果不错,但我无法让richfaces轮询正常工作。确切地说:id为someoutput2的输出元素在1000毫秒后不会被a4j:poll元素更新 以下是页面代码: <h:body> <h:form id="baseForm"> <h:outputText value="Input field"/> <br/> <h:inputText value="#{valu
<h:body>
<h:form id="baseForm">
<h:outputText value="Input field"/>
<br/>
<h:inputText value="#{valueBean.value}">
<f:ajax event="keyup" render="baseForm:someOutput"/>
</h:inputText>
<br/>
<br/>
<h:outputText value="Updated via AJAX:" style="color:red"/>
<br/>
<h:outputText id="someOutput" value="#{valueBean.value}" />
<br/>
<h:outputText value="Updated via Polling:" style="color:green"/>
<br/>
<!-- Polling target -->
<h:outputText id="someOutput2" value="#{valueBean.value}" />
</h:form>
<a4j:region>
<h:form id="pollForm">
<a4j:poll id="poll" interval="1000" timeout="500" enabled="true" reRender="pollForm:poll baseForm:someOutput2"/>
</h:form>
</a4j:region>
</h:body>
您不能直接更新组件,例如
,您必须在其父组件上调用reRender。在这种情况下,您可能希望将输出包装在
中,然后重新启动面板
@ManagedBean
@SessionScoped
public class ValueBean {
private String value = "";
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}