sending a parameter to ManagedBean from the JSF's JSP
HI,
I have a datatable in which i declared a variable var,say. The point is that i want to call a function of the Manged Bean some thing like #{managedBean.customFunction(<parameter>)}. THe parameter comes from the variable of data tabe, some thing like <parameter>= var.getPrimarykey, etc.
Every time the variable loops through the datatable, it should send a parameter to the managed bean and the bean would return back a strng that needs to be displayed to screen.
I am not knowing how to do it. Please help me.
Regards,
Ravi C
# 1
Check http://balusc.xs4all.nl/srv/dev-jep-com.html for different ways of communicating inside JSF.
As you're actually talking about datatables, you might find the HtmlDataTable#getRowData() more useful. In the customFunction() which is called inside the datatable you then can retrieve the current row object through it.
# 2
HI,
Thanks for the reply. Probably i need to be more clear. I am having a JSF data-table ( this is not the database) which is rendered from an arrayList of the managed bean. The point is for every row that is rendered by the data-table (we are rendering category names, say), i need to get the corresponding information (i.e. the employees in the category etc)
for this i thought it would be nice if we had a facility in JSF page where i can send the category id (say primary key) to the backing bean so that the bean can return the relevant information (Employees corresponding to the primary key)
Regards,
Ravi C
# 3
You may find this article useful: http://balusc.xs4all.nl/srv/dev-jep-dat.htmlIt also describes how to retrieve the row object using getRowData() inside the backing bean.Or if you want to prepopulate this from the database, consider nesting datatables.