• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not getting new values in backing bean

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anytime :thumb:

I'm glad that I helped ...
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic