Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get values from dynamic component?

 
anupv desai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic