primefaces部分提交数据表

发布于 2024-12-14 19:19:38 字数 796 浏览 1 评论 0原文

我需要使用此处描述的功能创建一个数据表如何动态添加 JSF 组件< /a>

它有效,但在我的表单中,除了这个数据表之外,我还有其他元素。我需要当单击添加按钮时,除了创建新字段之外,仅提交数据表中输入的数据。但 contact.email 的值始终为空。我正在尝试使用 primefaces 命令按钮。

<h:form>
//other elements
 <h:panelGrid id="region" columns="1">
  <p:commandButton action="#{myBean.addContact}" update="region"  value="add" immediate="true" process="region @this" ajax="true"/>
    <h:dataTable id="addContacts" value="#{myBean.contacts}" var="contact">
    <h:column>
        <p:inputText id="email" value="#{contact.email}" />
    </h:column>
</h:dataTable>
</h:panelGrid>
</h:form>

我怎样才能使这个部分提交工作?

谢谢

I needed to create a datatable with the functionality described here How to dynamically add JSF components

It works, but in my form, besides this datatable I have other elements. I needed that when the add button is clicked, only the data entered in the datatable is submitted besides creating the new field. But the values to contact.email are always null. I'm trying to use primefaces commandbutton.

<h:form>
//other elements
 <h:panelGrid id="region" columns="1">
  <p:commandButton action="#{myBean.addContact}" update="region"  value="add" immediate="true" process="region @this" ajax="true"/>
    <h:dataTable id="addContacts" value="#{myBean.contacts}" var="contact">
    <h:column>
        <p:inputText id="email" value="#{contact.email}" />
    </h:column>
</h:dataTable>
</h:panelGrid>
</h:form>

How can I make this partial submit work?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谢绝鈎搭 2024-12-21 19:19:38

在 PrimeFaces 中尝试在表单中使用 prependId="false" 属性

<h:form prependId="false">

In PrimeFaces try using prependId="false" attribute in the form

<h:form prependId="false">
时光礼记 2024-12-21 19:19:38

使用逗号分隔要部分提交的组件

process="@this,addContacts"

use commas to separate the components you want to partially submit

process="@this,addContacts"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文