Meaningless Drivel is fun!
The moose likes JSF and the fly likes Backing bean does not get updated data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Backing bean does not get updated data" Watch "Backing bean does not get updated data" New topic

Backing bean does not get updated data

Srikanth Nittala

Joined: Sep 24, 2006
Posts: 22
I have radio buttons (labeled Yes / No) on my page that control the display of a panelFormLayout( that contains a list of <tr.inputText> and SelectOneChoice fields).
Here is the scenario where i am facing the problem:
- User visits the page with the radio button value is 'No'(read from DB) and the page wont display the PanelFormLayout with the fields.
- User selects 'Yes' radio button, this triggers a page 'submit' that calls a method inside the backing bean to set the 'rendered' attribute of the panelformLayout to 'true'. The panelFormLayout now gets displayed and the fields are visible.
- User enters new values into the form fields inside the PanelFormLayout and clicks 'save' button that calls 'Save' method inside the backing bean.

Problem: The values user entered in the fields inside the PanelFormLayout are not picked up. The backing bean still sees only the default(initial) values.

This does not occur when the radio button value is 'Yes'. This means when user visits the page, the PanelFormLayout and its fields are rendered right away. IF user changes the values inside PanelFormLayout, and clicks on save, the 'save' method inside the backing bean sees those updated values.

It appears that only when the fields are displayed by default JSF picks up the updated field values, but if we display the fields conditionally or at a later point, JSF not pick up the updated field values.

Is my observation/assumption correct? If so what should be my course of action? Please suggest a solution for my problem.

Please excuse if my description is verbose. I only wanted to be clear about my problem.

Thanks for your time and help,
I agree. Here's the link:
subject: Backing bean does not get updated data
It's not a secret anymore!