Monkeyden,

See [1]. This is from the front page of the wiki.

Alternatively, all managed beans can be accessed directly from the appropriate scope (i.e. request, session).

I found the following utility method (based on the wiki page) useful in my application:

/**
* Look up a managed bean by JSP-EL value-binding expression
* @param ref a value-binding expression to lookup
* @return the managed bean referenced by the expression
*/
public static Object getManagedBean(String ref) {
        // Find or create the web-tier data object
        // ref like "#{myBean}"
        FacesContext context = FacesContext.getCurrentInstance();
        ValueBinding binding = context.getApplication().createValueBinding(ref);
        return binding.getValue(context);
}

[1] http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

monkeyden wrote:
Im using a Tomahawk tabbedPane in my JSP

<t:panelTabbedPane id="tabbedPane" bgcolor="#ffffff" width="650"
serverSideTabSwitch="true" selectedIndex="#{myBackingBean.selectedTab}">

I want to implement a TabChangeListener, to set the "selectedTab" value of
the backing bean.  I don't need to change the view of the component at all,
since that's handled automatically.  I just need to know what the currently
selected tab is.  Looking at the hierarchy, there doesn't seem to be a way
to get my backing bean instance from session to set the value.  This is how
I would expect this to be done.  Please tell me if I'm way off base or not.

processTabChange(TabChangeEvent tabChangeEvent){
    MyBackingBean myBean = [get the bean somehow];
    myBean.setSelectedTab(tabChangeEvent.getNewTabIndex());
}


Reply via email to