jsf和primefaces更新问题 [英] jsf and primefaces update problem

查看:127
本文介绍了jsf和primefaces更新问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有两种形式的JSF页面(下面的伪代码).

I have a JSF page with two forms (pseudo-code below).

第一种形式是针对用户的,具有文本字段和电话号码表,以及一个链接,用于 添加新的电话号码.

First form is for a user and has text fields and a table of phone numbers, and a link for adding a new phone number.

第二种形式是p:对话框,它显示了将电话号码添加到列表中的形式.

Second form is the p:dialog that shows the form for adding a phone number to the list.

我遇到的问题是p:dialog关闭后,我希望列表不被更新.如果我将p:dialog标记放在第一个表单中,列表的确会更新,但是有两个单独的表单,因为我需要在单独的操作中验证其内容.

The problem I have is after the p:dialog closes, I want the list is not getting updated. If I put the p:dialog tag inside the first form, the list does get updated but there are two separate forms because I need their contents to be validated in separate actions.

我的问题的简短版本:p:dialog的属性为attr update ="phonesPanel",但phonePanel的格式不同;我该如何做类似update ="personForm.phonesPanel"的操作,以便它以不同的形式更新列表?

SHORT VERSION OF MY QUESTION: The p:dialog has an attr update="phonesPanel" but phonePanel is in a different form; how do I do something like update="personForm.phonesPanel" so it updates the list which is in a different form?

<h:form id="personForm">

  <p:messages />

  <h:inputText label="Full Name" value="... />

  <p:commandLink value="Add Phone Number" onclick="dlg.show();" />

  <h:panelGrid id="phonesPanel" columns="1" style="width:100%" >
    <h:dataTable id="phonesTable">
      // ...
    </h:dataTable>
  </h:panelGrid>

</h:form>


<h:form>

  <p:dialog id="dialog" modal="true" widgetVar="dlg">
     <p:messages />
     <h:inputText label="Phone Number" value="... />
     <p:commandButton value="Add Phone Number" update="phonesPanel"   
       actionListener="#{handler.doAddPhoneNumber}" 
       oncomplete="handleLoginRequest(xhr, status, args)"/>  
  </p:dialog>

</h:form>

任何帮助将不胜感激!

rob

推荐答案

回答我自己的问题.

答案是:update ="personForm:phonesPanel"

The answer is: update="personForm:phonesPanel"

谢谢!

这篇关于jsf和primefaces更新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆