I am trying to create a sql data table that can be fully edited and displayed on a single page. I am using jsf and a named bean. I use a arraylist bean object to store and display the data.
public List<RegionBean> getRegions()throws SQLException{
The data is displayed in an inputText element. When I try to update the information using a sql method in the backing bean it fails to add the updated text to sql data base. It will simply put the same value as was originally displayed. What I want to do is have the input text box display the data values from the array list and then store them in a different field in the bean after they have been edited.
Here is my code as it is 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 I am having with this UIComponent-ClientId=, Message=javax.el.PropertyNotWritableException:
In the bean I have
public void updateText(AjaxBehaviorEvent event)
throws AbortProcessingException { }
How can I pass the new input text box value to this method so as I can store it as String in the bean and thus able to use it to update the sql database.
Please understand that I am familiar with sql and I have built several CRUD applications before and my question is not related to sql syntax or other wise.