This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InputText in DataTable does not store value

 
Klaus Schuster
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the problem, that I am using a dataTable from tomahawk for iterating an List:





The update I made in the inputtext is not represented in the List.

What is the problem, when I save with the button, that my object model is not filled (by using setters) ?
In Debug mode I can see that a new instance is using my setters.
Therefore the different instances causes the problem, that I have to use the binding.
Any explaination for me?

Because I didn't find an answer for my question, I tried to use a binding as mentioned above.
But there is no updated data in the List. Can anyone help me?
Thanks,
Klaus

PS: Related Article: Same Problem in another code ranch article
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to access the 'populatedFoos' property in the action method. The updated model values are in there. You should also rather populate the list in the constructor of the backing bean. A getter can be called more than once in bean's life and is in fact solely intented to return a bean property, not to do some (non-lazy) loading actions. After all you need to ensure that the same list is constructed during the apply request values phase of the subsequent request as it was during the render response phase of the initial request. If the bean is request scoped (good choice) and you want to prevent the datamodel being loaded everytime, you can use preserveDataModel attribute of the t:dataTable for this.

You may find the examples in this article useful as well: http://balusc.blogspot.com/2006/06/using-datatables.html
 
Klaus Schuster
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Code now looks like this:

I am using the session scope, and when I check the 'popultedFoos' Variable, no update is made after clicking the save button.
In the updatedFooList there is also the old value...
I don't know where the problem is located.
 
Klaus Schuster
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, everything works with an List. I thought i am using a list for my value in the datatable.
But it was a map. (values of map) which has shown me the data, but couldn't use any setter at the storing process...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic