JSF 10.1.3EA: af:menuTabs and menuitems calling action methods
48910Nov 17 2005 — edited Jan 10 2006I am trying to use af:menuTabs as spelled out in the demo using a menu model. What I would like to do is to get one of the menu items (when clicked) to frist call an action method in one of my backing beans. I belived I could set the outcome for the menu item as follows:
<managed-property>
<property-name>outcome</property-name>
<value>#{recent.refreshAction}</value>
</managed-property>
But when I try this I get the following:
javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.FacesException: The scope of the referenced object: '#{recent.refreshAction}' is shorter than the referring object at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206) at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
The menuTab is used as follows:
<af:menuTabs var="menuItem" value="#{menuModel.model}">
<f:facet name="nodeStamp">
<af:commandMenuItem text="#{menuItem.label}"
action="#{menuItem.getOutcome}" immediate="true"
rendered="#{menuItem.type=='default'}"/>
</f:facet>
</af:menuTabs>
<managed-bean>
<managed-bean-name>menuItem_recent</managed-bean-name>
<managed-bean-class>com.shiny.menu.MenuItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>Recent</value>
</managed-property>
<managed-property>
<property-name>viewId</property-name>
<value>/recent.jsp</value>
</managed-property>
<managed-property>
<property-name>outcome</property-name>
<value>#{recent.refreshAction}</value>
</managed-property>
</managed-bean>
<navigation-case>
<from-action>#{recent.refreshAction}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/recent.jspx</to-view-id>
</navigation-case>
But if I use the following navigation case (and set the outcome of the menu item accordingly) all is ok but not what I want as I need some objects setup first.
<navigation-case>
<from-outcome>guide.alc_rec</from-outcome>
<to-view-id>/recent.jspx</to-view-id>
<redirect/>
</navigation-case>