Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 Richfaces轮询失败_Jsf 2_Richfaces_Facelets_Polling - Fatal编程技术网

Jsf 2 Richfaces轮询失败

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

通过ajax进行更新似乎效果不错,但我无法让richfaces轮询正常工作。确切地说:id为someoutput2的输出元素在1000毫秒后不会被a4j:poll元素更新 以下是页面代码:

<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;
    }
}