File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Identify selectone inside DataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Identify selectone inside DataTable" Watch "Identify selectone inside DataTable" New topic

Identify selectone inside DataTable

Gabriel Beres
Ranch Hand

Joined: Sep 09, 2006
Posts: 61

i have a datatable, which content is created programatically. At every row, there is a selectone componenent. These selectone-s have a JSF valuechangelistener attached, and when the user change the value, the valuechangelistener fires.

Since the selectone is in a datatable, i need to identify the selectone-s, based on the var attribute of the table. For example if var is a Category object. i would like to set the selectone-s id to myselect_#{category.category_id}. Then i could get this id on the valuechanged event handler, and do something with it.

The problem is when i try this:

selectone.setValueExpression("id", JSFUtils.createValueExpression("#{category.category_id}", String.class));

I bet this is not valid, because it gives me IllegalArgument exception.

Is there another way, to do what i want? (note that i use JSF 2.0)

wood burning stoves
subject: Identify selectone inside DataTable
It's not a secret anymore!