Two Laptop Bag*
The moose likes JSF and the fly likes How to get values from dynamic component? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to get values from dynamic component?" Watch "How to get values from dynamic component?" New topic
Author

How to get values from dynamic component?

anupv desai
Greenhorn

Joined: Jan 09, 2012
Posts: 2

Hi:

I am displaying dynamic components based on user selection, where InputText and OutputText display properly. But now i want to read that component value on
button click. Can any body help me in that?
Source code is as follow,

test.xhtml



bean.java



Thank You,
Anup


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Welcome to the JavaRanch, Anup!

Good JSF practice is to avoid raw HTML. In the case of tables, a panelGrid or dataTable tag would be more appropriate.

JSF is HTTP-based, and HTTP is based on batch submission of forms. To update only a single field when a button is clicked therefore means that you need to either have no other fields in the form that contains the button and input control or that you use AJAX to do partial page processing. IceFaces can do that and in JSF2, there's also an "ajax" tag that can do that.

If you have properly set up your view definition, you don't need to "get" values, because JSF will "put" them into the backing bean automatically by invoking the "set" method for the value property that was assigned to the input control on its tag element.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Consider Paul's rocket mass heater.
 
subject: How to get values from dynamic component?