【发布时间】:2017-06-14 18:22:59
【问题描述】:
我有一个输入文本的表单,操作员在其中输入 clientid 并单击“搜索”,当搜索完成后,表单中的其他字段被正确填充。
然后我有按钮“新记录”,它调用创建另一个对象(不是客户)并需要持久化它的过程,当在 bean 中创建另一个对象时,它会从表单中获取除时间戳之外的每个字段.
当对象被持久化时,只有时间戳在数据库中,所有的表单值都设置为空。
<h:form id="myForm">
<h:outputText value="Customer number" />
<h:inputText id="cIdentidad" value="#{custBean.custID}" />
<p:commandButton process="@all" update="@all" action="#{custBean.populateFields(custBean.custID)}" value="Search" />
<p:growl />
<h:panelGrid id="newCust" columns="2" style="margin-top: 15px">
<h:outputText value="Name" />
<h:inputText id="name" value="#{custBean.name}" disabled="true"/>
<h:outputText value="more fields" />
<h:inputText id="nroAgenda" value="#{custBean.morefields}" disabled="true"/>
</h:panelGrid>
<p:commandButton process="@all" update="@all" action="#{custBean.newRecord()}" value="New record" />
</h:form>
【问题讨论】:
-
bean 是 sessionscoped
标签: forms jsf primefaces