jsf - Richfaces editable dataTable not setting updated values in Bean -
i have tried bunch of suggestions after googling none has far worked me. trying display simple datatable editable inputtext values in each row. table being populated database via usual list of objects. here xhtml page , managed bean
richfaces 4.2.1, jsf 2 mojarra bundled jboss 7.1, jdk 1.6
<rich:datatable value="#{wlscorebean.scorelist}" binding="#{wlscorebean.scoretable}" var="item" id="table" style="width:100%"> <rich:column> <f:facet name="header">param name</f:facet> <h:outputtext value="#{item.paramname}" /> </rich:column> <rich:column> <f:facet name="header">1 score</f:facet> <h:inputtext value="#{item.name1}" /> </rich:column> <rich:column> <f:facet name="header">2 score</f:facet> <h:inputtext value="#{item.name2}" /> </rich:column> </rich:datatable> <br/> <h:panelgrid columns="3" id="buttonrow"> <a4j:commandbutton value="save" render="table" execute="@this" action="#{wlscorebean.update()}"> </a4j:commandbutton> </h:panelgrid> import java.io.serializable; import java.util.list; import javax.annotation.postconstruct; import javax.ejb.ejb; import javax.faces.bean.managedbean; import javax.faces.bean.viewscoped; import javax.faces.component.html.htmldatatable; import javax.faces.event.valuechangeevent; import org.richfaces.component.uidatatable; @managedbean(name = "wlscorebean") @viewscoped public class ws implements serializable { private static final long serialversionuid = 1l; private htmldatatable scoretable; private list<workloadscore> scorelist; public void watchscore(valuechangeevent e) { system.out.println("old value="+e.getoldvalue() + ", new value="+e.getnewvalue()); } public list<workloadscore> getscorelist() { return scorelist; } public void setscorelist(list<workloadscore> scorelist) { this.scorelist = scorelist; } @ejb private workloadscoremanagerservice wlscoremanager; public htmldatatable getscoretable() { return scoretable; } public void setscoretable(htmldatatable scoretable) { this.scoretable = scoretable; } public workloadscorebean() { } @postconstruct private void getallscores() { this.scorelist = wlscoremanager.getallscores(); } public void update() { (workloadscore wls : getscorelist()) { system.out.println(wls.getparamname()+"="+wls.getportabilityscore()+","+wls.getvirtualizationscore()); } //wlscoremanager.update(workloadscore); } } here's things tried. of them result in old values being printed console in update() method.
- changed rich:datatable plain old jsf h:datatable, same result
bound datatable managed bean property, checked in update() method, old values being printed here too. did getvlaue() on uidatatable object , cast list.
the list supposed have been updated changed values form, not see happening. did make sure put mbean in viewscope.
do have h:form outside datatable? , did try replace inputtext inplaceinput fields?
Comments
Post a Comment