I spent already more time as is good about some saving or updating issue in inputtext field, i go right to the point: i have basic single input text with some basic attributtes
<h:inputText id="name" value="#{salesController.selectedSalesName}" />
here is a getter for inputText value
public String getSelectedSalesName(){
for(DealerListView dealer : dealerList){
if(dealer.getDealerId() == getSelectedDealerId()){
return dealer.getName();
}
}
return "";
}
nested in there i use ajax tag
<f:ajax event="change" render="name" listener="#{salesController.updateSelectedSalesName()}" />
a here is back bean method for updating a input text field
public void updateSelectedSalesName() {
DealerData dealDat = BeanFactory.getHotelDAOService(DealerData.class).findOne(selectedDealerId);
dealDat.setName(name);
BeanFactory.getHotelDAOService(DealerData.class).update(dealDat);
}
whole result of this is stack trace which say
value="#{salesController.selectedSalesName}": Property 'selectedSalesName' not writable on type sk.hotel.web.controller.SalesController
I know that something changes is need for that getter method but try some combinations without result which make corect update of value to database.
(I dont use any commands buttons for submit,update only response on pressing Enter in that inputText field.) I want some guide how can be modified this save/update process whether on back-bean or jsf layout or maybe someone solved similar situation already,and can share his solution.
Thanks all of you for advice posts. Regards and nice day
<h:inputText>value attribute binding needs both setter and getter of the bean's property and the former should cause the prblems you face. 2. You will face performance problems, as the getter may be called many times and the way you wrote it is resource-consuming (alternative: use other String property that you evaluate inConstructor/@PostConstructmethod /preRenderViewevent. 3. Ajax listener must be of the following typepublic void ajaxListener(AjaxBehaviorEvent event), so change your method declaration in your bean.