Java Primefaces In cell editing data table事件。getNewValue()将旧值发送到bean
我正在尝试使用素数面的功能,该功能允许用户编辑表格中的单元格数据。我已通过以下链接实现: 当我说编辑表中的单元格时,输入的新值不会发送到bean,它仍然只显示旧值 我的代码JSF:Java Primefaces In cell editing data table事件。getNewValue()将旧值发送到bean,java,jsf,jsf-2,primefaces,Java,Jsf,Jsf 2,Primefaces,我正在尝试使用素数面的功能,该功能允许用户编辑表格中的单元格数据。我已通过以下链接实现: 当我说编辑表中的单元格时,输入的新值不会发送到bean,它仍然只显示旧值 我的代码JSF: <h:form id="testform"> <p:growl id="messages" showDetail="true" /> <p:outputPanel id="testContainer" deferred="true">
<h:form id="testform">
<p:growl id="messages" showDetail="true" />
<p:outputPanel id="testContainer" deferred="true">
<p:remoteCommand name="oncompleteCellEdit" update="cars messages" />
<p:dataTable id="cars" var="car" value="#{articlesbean.LMatpilotaccess1}" editable="true" editMode="cell" widgetVar="carsTable" update=":cars">
<f:facet name="header">
Matériel du pilotage et accessoires
</f:facet>
<p:ajax event="cellEdit" listener="#{articlesbean.onCellEdit}" oncomplete="oncompleteCellEdit()" update=":testform:messages" />
<p:column headerText="Serie" style="width:25%">
<p:cellEditor >
<f:facet name="output"><h:outputText value="#{car.serie}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput16" value="#{car.serie}" style="width:96%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Cap" style="width:25%">
<p:cellEditor >
<f:facet name="output"><h:outputText value="#{car.cap}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput15" value="#{car.cap}" style="width:96%"/></f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</p:outputPanel>
</h:form>
由于
System.out.println("/////"+(event.getNewValue());
System.out.println("/////"+(event.getOldValue());
在这两种情况下,我都得到了旧值
有人能告诉我如何获得新值吗???我正在使用Jboss 7和primefaces4谢谢你需要用@SessionScoped注解来注解你的bean。你需要用@SessionScoped注解来注解你的bean。LMATPILOTACCESS是一个列表吗?我知道那是两年前的事了,但我偶然发现了这个问题。LMATPILOTACCESS是一个列表吗?我知道那是两年前的事了,但我偶然发现了这个问题。
System.out.println("/////"+(event.getNewValue());
System.out.println("/////"+(event.getOldValue());