Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.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
Javascript Primefaces ajax未以相同形式更新panel或panelGrid组件_Javascript_Jquery_Ajax_Jsf_Primefaces - Fatal编程技术网

Javascript Primefaces ajax未以相同形式更新panel或panelGrid组件

Javascript Primefaces ajax未以相同形式更新panel或panelGrid组件,javascript,jquery,ajax,jsf,primefaces,Javascript,Jquery,Ajax,Jsf,Primefaces,我正在尝试编写一个应用程序,注册一个新用户,让他们在创建登录详细信息后填写用户配置文件。我需要另一个表单来显示用户作为验证输入的内容的精确副本,之后用户可以在保存配置文件表单之前接受或编辑输入 使用以下操作成功创建用户: public String makeUser() { if (nameAvailable = true) { facade.create(newUser); } else { userMessage = "VALIDAION F

我正在尝试编写一个应用程序,注册一个新用户,让他们在创建登录详细信息后填写用户配置文件。我需要另一个表单来显示用户作为验证输入的内容的精确副本,之后用户可以在保存配置文件表单之前接受或编辑输入

使用以下操作成功创建用户:

public String makeUser() {

    if (nameAvailable = true) {
        facade.create(newUser);
    } else {
        userMessage = "VALIDAION FAILED. Please try again and check that your uder name is not already taken";
    }

    selUser = newUser;
    return "/Main/Users/UserProfile";
}
然后将用户定向到配置文件表单:

<h:form id="proform">
    <p:outputPanel id="propan">
    <p:panelGrid id="userpro" columns="2">
    <p:outputLabel value="Salutation"/>
    <p:inputText value="#{userBean.salutation}"/>

    <p:outputLabel value="First Name:"/>
    <p:inputText value="#{userBean.proFirstName}"/>

    <p:outputLabel value="Surame:"/>
    <p:inputText value="#{userBean.proSurname}"/>

    <p:outputLabel value="Date of Birth:"/>
    <p:calendar value="#{userBean.dateofbirth}"/>


    </p:panelGrid>
    <p:commandLink id="make" value="Create"
    action="#{userBean.checkProfile}"
    process=":proform:make :proform:userpro"
     update="proform:usercheck"/>

//  also tried 
     process="userpro"
     update="usercheck"/>
用户检查表为:

    <p:panelGrid id="usercheck" columns="2"> 
    <p:outputLabel value="#{userBean.newPro.saltuation}"/>
    <p:outputLabel value="#{userBean.newPro.firstname}"/>
     <p:outputLabel value="#{userBean.newPro.surname}"/>
    <p:outputLabel value="#{userBean.newPro.dateofbirth}"/>
     <p:commandLink id="accept" value="Accept"
    action="#{userBean.makeProfile}" 
    ajax="false"/>
    </p:panelGrid>
</h:form>
由于控制台完全为空,这表明ajax请求没有首先被触发,这让我认为我在checkProfile操作的流程部分做了一些错误的事情?

更新:

针对BalusC的评论,请注意,我已经完成了以下问题(标记为重复)中的所有要点:

具体来说,我已经看了第8点

如果您使用的是Ajax,那么请确保UIInput和UIInput命令 感兴趣的组件包含在
中,例如。
,否则它们将不会被执行/处理。 另请参见了解PrimeFaces的过程和更新属性

至于问题中的其他几点:

  • 1) UICommand和UIINput组件位于h:form标记内
  • 2) 多个UIForm组件似乎没有嵌套
  • 3) 似乎没有发生输入验证错误,并且 以下消息标记显示为空白:

      <p:messages id="msg" for="make" 
      showDetail="true" 
      autoUpdate="true"/>
    
    这表明恢复视图状态时存在问题,因为以前在创建用户时呈现了一个页面。是否需要刷新视图状态


    我建议这个问题不是重复的,可能比重复中提到的13点错误更多?谢谢

    请参见dupe的第8点。我已经查看了第8点并更新了问题。我想我现在在我的流程操作中包括了UICommand和UIInput,但是请求似乎仍然没有被触发,所以不确定这个问题是否真的是一个重复?非常感谢。然后,其他一点可能适用。您是否绑定了超出请求范围的组件?MCVE在一个更集中的问题上会有助于解决这里太多的歧义。根据目前提供的信息,没有人能够重现您的问题。
    PrimeFaces.ajax.Request.handle(cfg);
    PrimeFaces.ajax.Response
    
    <p:commandLink id="make" value="Create"
    action="#{userBean.checkProfile}"
    process=":proform:make :proform:userpro"
    update=":proform:usercheck"/>
    
    System.out.println("New Profile First Name" + newPro.getFirstname());
    
      <p:messages id="msg" for="make" 
      showDetail="true" 
      autoUpdate="true"/>
    
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:604)
    at java.util.ArrayList.get(ArrayList.java:382)
    at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:165)
    at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1607)
    at com.sun.faces.application.view.FaceletPartialStateManagementStrategy$2.visit(FaceletPartialStateManagementStrategy.java:380)
    at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:367)