jsf - Pass h:inputText value to f:ajax listener -


this question has answer here:

i trying create sql data table can edited , displayed on single page. using jsf , named bean. use arraylist bean object store , display data.

public list<regionbean> getregions()throws sqlexception{ 

the data displayed in inputtext element. when try update information using sql method in backing bean fails add updated text sql data base. put same value displayed. want have input text box display data values array list , store them in different field in bean after have been edited.

here code now.

<h:datatable value="#{regionbean.regions}" var="regions"/>   <h:column>     <f:facet name="header">region id</f:facet>                            #{regions.regionid} </h:column> <h:column>     <f:facet name="header">region description</f:facet>     <h:inputtext id="des" value="#{regions.regiondescription}">     <f:ajax event="change"              listener="#{regionbean.updatetext(event)}"             render="des"/> </h:inputtext> <h:column>     <f:facet name="header">save</f:facet>     <h:commandbutton action="#{regionbeanupdate(regions.regionid)}" value="update">     </h:commandbutton> </h:column> 

the problem having uicomponent-clientid=, message=javax.el.propertynotwritableexception:

in bean have

public void updatetext(ajaxbehaviorevent event)             throws abortprocessingexception { } 

how can pass new input text box value method can store string in bean , able use update sql database.

please understand familiar sql , have built several crud applications before , question not related sql syntax or other wise.

remove listener , render <f:ajax> add valuechangelistener <h:inputtext>.

<h:inputtext value="#{regions.regiondescription}" valuechangelistener="#{region.updatetext}">      <f:ajax event="change"/> </h:inputtext> 

then in bean:

public void updatetext(valuechangeevent event){    input = event.getnewvalue().tostring(); } 

note: input variable in new value stored.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -