Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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
Ajax 显示输出文本和选择器Radio,无需手动重新加载_Ajax_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Ajax 显示输出文本和选择器Radio,无需手动重新加载

Ajax 显示输出文本和选择器Radio,无需手动重新加载,ajax,jsf,jsf-2,primefaces,Ajax,Jsf,Jsf 2,Primefaces,我在显示“outputText”和“selectOneRadio”时遇到问题 我想要的是:如果用户填写一个inputText,那么将显示一个outputText和一个selectOneRadio。 主要问题是,只有在手动重新加载页面时,它才能工作 这是我的xhtml页面: <h:form id="profil"> <h:outputText id="teffect1" styleClass="colo

我在显示“outputText”和“selectOneRadio”时遇到问题

我想要的是:如果用户填写一个inputText,那么将显示一个outputText和一个selectOneRadio。 主要问题是,只有在手动重新加载页面时,它才能工作

这是我的xhtml页面:

                 <h:form id="profil">
                     <h:outputText  id="teffect1" styleClass="colonne" value="#{messages['content.effectif']}" />
                     <p:inputText id="iteffect1" value="#{effectifBean.efCadre}" validatorMessage="test" >
                         <p:ajax event="change" update=":profil:wrapper" listener="#{effectifBean.efCadre}" process="@form" />
                     </p:inputText>

                    <h:panelGroup id="wrapper"> 

                        <h:outputText rendered="#{effectifBean.shouldRenderCadre() eq true}" value="#{messages['content.type1']}" /> 
                        <p:selectOneRadio rendered="#{effectifBean.shouldRenderCadre() eq true}" > 
                            <f:selectItem itemLabel="#{messages['content.option1']}" itemValue="1" /> 
                            <f:selectItem itemLabel="#{messages['content.option2']}" itemValue="2" /> 
                            <f:selectItem itemLabel="#{messages['content.option3']}" itemValue="3" /> 
                        </p:selectOneRadio> 

                    </h:panelGroup>

                </h:form>
}


谢谢您的帮助。

换句话说,当您更改输入字段,然后通过跳出来离开该字段时,它不起作用?很多新手都有一种错误的印象,即只要你还在现场,就会立即触发
change
事件。在任何情况下,检查JS控制台和HTTP监视器都会给出整个ajax过程是否成功的线索。“换句话说,当您更改输入字段,然后通过勾选退出该字段时,它不起作用?”是的,这就是问题所在。我在控制台中没有看到任何错误:-(是否触发了ajax请求?这也应该在HTTP(网络)监视器中可见。从
p:ajax
中删除
listener=“#{effectifBean.efbrancher}”
。Thx这就是,Thx感谢您的帮助!
public class EffectifBean {

private String efCadre;

public String getEfCadre() {
    return efCadre;
}
public void setEfCadre(String efCadre) {
    this.efCadre = efCadre;
}

public boolean shouldRenderCadre(){
    if (efCadre != null && !efCadre.isEmpty() && !efCadre.equals("0")) {
        return true;
    } else return false;
}