• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not getting new values in backing bean  RSS feed

 
Ram Suryanshi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having a JSF page and having few UIInput components i.e. text fields. When i load page it gets the data from database and all my GUI fields are read only.

Now i have one edit button on clicking of which it makes some of the fields editable. I change the value of some of the fields and submit the page.

Now what it is doing that in my DTO - Data Transfer Object , it is showing me the old values not new one.

Can you please what can be the reason for that.

Thanks
Ram
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You have to register a ValueChangeListener by adding a method that accepts a ValueChangeEvent as a parameter and bind your code to it.

Now when the event gets fired, that method will be invoked, so now your role is to invoke the getNewValue() method on the valueChangeListener event to obtain the new value.

As an example:



For more information, take a look at the ValueChaneListener and ValueChangeEvent APIs.

Best of luck ...
 
Ram Suryanshi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sir for your help.

Thanks,
Ram
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anytime :thumb:

I'm glad that I helped ...
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to register a ValueChangeListener by adding a method that accepts a ValueChangeEvent as a parameter and bind your code to it.
That's a way around which doesn't solve the actual issue.

My bet that the values are being wrongly scoped. A simple test: put the managed bean in the session scope. If it solves the problem and you want to keep it in the request scope, show the relevant JSF code. If you want to solve it yourself, read on about the JSF lifecycle.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!