It's not possible to call methods with functions in JSF EL, but you
should be able to use #{X.hobbyMethod}
and then use
public void hobbyMethod(ActionEvent e)
{
b = UsersBean.getUsersRichList().getRowData();
...b.username.....
}
in your java code.
UsersBean.getUsersRichList() returns a UIData, not a List, by the way.
I still don't think this will do what you want as this isn't the
correct way to initialize a selectOneMenu.
Instead, you should create a getHobbies() method which returns a
SelectItems[] array. In it, you'd iterate over your #{Users.users}
list, assigning the b.hobbies value to each label, and b as the
SelectItem value.
You might need or want to create a HobbyConverter (assuming Hobby is
the data type of B).
On 3/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I am looking to call a function from my bean into my jsp page.
> For example:
> - Bean class: Users
> - Bean class: X
> - in this class X I have the function: getHobbies(username)
> - in my jsp page I get all users nodes and I want to display each user with
> the list of his hobbies thanks to this function getHobbies, please would you
> mind telling me if it is possible? I was thinking of something like this:
>
> <a:richList id="users-list" binding="#{UsersBean.usersRichList}"
> viewMode="details" pageSize="10"
> styleClass="recordSet" headerStyleClass="recordSetHeader"
> rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
> value="#{Users.users}" var="b" initialSortColumn="userName"
> initialSortDescending="true">
>
> <h:selectOneMenu id="hobbies" style="width:150px" >
> <f:selectItems actionListener="#{X.getHobbies(b.username}" />
> -->how to call the function
> here
> </h:selectOneMenu>
>
> Thanks
> Best
> Sophie
>
>