Call multiple backing bean methods at the same time

Is there a way to call multiple methods from different backing beans in JSF?

I have an application that stores user information. I have multiple backing beans which are broken down into schedule, address, phone.. etc.

When the application initially loads everything works find but since all of my views are of type @ViewScope the lists of schedule, address, phone are maintained even if a new user is displayed.

I need to manually set the schedule, address, and phone lists to null when the user navigates away from the current person they are viewing IE I need to call a method in each managed bean at one point in time (When the user clicks on a commandLink).

Is it possible to call multiple bean methods on one commandLink?


<h:commandLink action="#{jsfBean.submit}" value="execute multiple methods">
    <f:actionListener binding="#{jsfBean1.actionListener}"/>
    <f:actionListener binding="#{jsfBean2.actionListener}"/>
    <f:actionListener binding="#{jsfBean3.actionListener}"/>

Using the above code, with methods in the beans have the ('default') signature of actionListener(ActionEvent event)

when you click the commandLink first the submit method will be executed. After that all the other actionListeners will be executed one by one...Hope that helps ;)

You can have your commandLink reference one method which itself calls all the necessary methods.

The answers here were close to working for me but also had to add parenthesis to the methods in the f:actionListener:

<h:commandLink action="#{jsfBean.submit}" value="execute multiple methods">
    <f:actionListener binding="#{jsfBean1.actionListener()}"/>
    <f:actionListener binding="#{jsfBean2.actionListener()}"/>
    <f:actionListener binding="#{jsfBean3.actionListener()}"/>

Need Your Help

A good Javascript API reference documentation related to browsers and DOM

javascript api reference

I am looking for a good API documentation for Javascript especially related to browsers and DOM. I am not looking for any kind of Javascript tutorial, but simply a documentation for all standard

Why can't files be manipulated by inode?

linux unix filesystems inode

Why is it that you cannot access a file when you only know its inode, without searching for a file that links to that inode? A hard link to the file contains nothing but a name and a number telling...