gpt4 book ai didi

jsf-2 - 如何在jsf中提交表单输入后重置表单输入

转载 作者:行者123 更新时间:2023-12-03 14:14:42 25 4
gpt4 key购买 nike

所以我有这段代码(不详细)

<p:tabView id="tabviewId">
<p:tab>
<h:form id="mainHeadOfAccountsId_form">
// some input fields with validation
// using viewscoped
<p:commandButton value="Add" process="mainHeadOfAccountsId_form" update="mainHeadOfAccountsId_form :#{p:component('allMainHeadOfAccountsId_table')} :#{p:component('successfullySavedUpdatedId_growl')}" action="#{budgetHeadOfAccountsAction.addMainHeadOfAccountsOnAjax}" />

/// also using <p:datatable id= "allMainHeadOfAccountsId_table" >
</h:form
</p:tab>

<p:tab>
<h:form>
</h:form
</p:tab>

</p:tabView>
<p:growl id="successfullySavedUpdatedId_growl" for="successfullySavedUpdatedFor_growl" value="error" showDetail="false" />

我的问题是,当我提交表格时 mainHeadOfAccountsId_form成功地我需要更新(重置)mainHeadOfAccountsId_form 中的所有字段但请记住,我也在使用 <h:selectOneMenu>所以我想重置(选项 [0] 选择)不为空,我该怎么做?目前正在更新allMainHeadOfAccountsId_tablesuccessfullySavedUpdatedId_growl除了 mainHeadOfAccountsId_form我累了tabviewId:mainHeadOfAccountsId_form但是找不到异常组件,因为我认为这只是因为 @viewScoped我应该在我的操作类 (.java) 中重置这些输入的值,我对吗?

最佳答案

查看 primefaces 为 reset input 提供的服务或者在通过 bean 中的操作提交表单后,通过 new 或 null 重置值并重新创建

持有的列表
<h:selectOneMenu>

关于jsf-2 - 如何在jsf中提交表单输入后重置表单输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19355253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com