Glen,

Please do not post these sorts of question to the dev list. It belongs on the 
user list. And definitely do not post to both lists; most developers are also 
subscribed to the user list. Posting to both just annoys the people you are 
hoping will help you.

In JSF, it is very rarely necessary to "fetch" data from the components. I 
presume that tempCoreTable is a componentBinding to the table component from 
the page. Using component bindings is ugly and should be used only when nothing 
else will work.

Usually the best solution for this sort of problem is to modify the objects 
that the table is rendering. So the table is no longer passed a list of 
ServiceBean objects, but instead a list of ServiceBeanHandler objects. The 
ServiceBeanHandler can then hold the logic that handles updates for each row 
rather than using the loop below. The tempCoreTable binding variable can then 
be deleted.

I don't know what this "getSelectedRowKeys" method is. There is no such method 
on a UIData object. Is this from Trinidad, or are you trying to write your own 
custom UIComponent or ???

In the past I have implemented tables where a column holds a checkbox for each 
row that the user can click to select a row. I guess this is what you are 
doing. In this case, the ServiceBeanHolder class can add a boolean property to 
hold the selected/unselected state of that particular row, with the checkbox 
component just mapping to that property.

Regards,

Simon

---- Glen <[EMAIL PROTECTED]> schrieb:
> 
> I have a problem with getting values of the inputText components from a
> dynamically generated table.  Table will have inputText components in each
> cell.  The value entered by user should come to backing bean.
> 
> The following is the code that shows how I am trying to get the values:
> 
> 
>             Iterator selectedRowKeys =
> tempCoreTable.getSelectedRowKeys().iterator();
>             while(selectedRowKeys.hasNext()) {
>                 ServiceBean tableRow =
> (ServiceBean)tempCoreTable.getRowData(Integer.parseInt(selectedRowKeys.next().toString()));
>                 System.out.println("Weight :: " + tableRow.getWeight());
>                 System.out.println("Minimum Value :: " +
> tableRow.getMinValue());
>                 System.out.println("Id :: " + tableRow.getDataID());
>                 System.out.println("Name :: " + tableRow.getName());
>             }
> 
> ServiceBean is a simple Java Bean that contains set of properties weight,
> minValue, dataId, name and their get-set methods.  Also the rows in the
> dynamically generated table are also of type ServiceBean.
> Please help me to get out this problem.
> -- 
> View this message in context: 
> http://www.nabble.com/Issue-with-getting-the-values-of-the-rows-in-dynamically-generated-Table-tf4789818.html#a13702158
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 

Reply via email to