incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Böhringer Jochen <Jochen.Boehrin...@tcc-products.de>
Subject Define Trinidad navigation in faces-config.xml using action methods instead of outcomes
Date Wed, 08 Nov 2006 17:41:23 GMT
Hello,

 

I have adapted the example from the Trinidad documentation (http://incubator.apache.org/adffaces/devguide/navigation.html)
about Navigation to fit my needs, but I have one major problem. I want to use the approach
to have the navigation hierarchy configured in the facelets-config.xml as a tree of managed
beans describing the label and action of the menu items. This way I can easily use components
like <tr:breadCrumbs> to render the way the user walked down the navigation path.

 

This works pretty good if I specifiy an outcome in this configuration for every item like
this snippets shows:

 

<managed-bean>

  <managed-bean-name>mtn_kape_editKeyAccount</managed-bean-name>

  <managed-bean-class>de.tccproducts.kn.jsf.model.MenuTreeNode</managed-bean-class>

  <managed-bean-scope>none</managed-bean-scope>

  <managed-property>

   <property-name>action</property-name>

   <property-class>java.lang.String</property-class>

   <value>showSearchKeyAccount</value>

  </managed-property>

  <managed-property>

   <property-name>description</property-name>

   <property-class>java.lang.String</property-class>

   <value/>

  </managed-property>

  <managed-property>

   <property-name>icon</property-name>

   <property-class>java.lang.String</property-class>

   <value/>

  </managed-property>

  <managed-property>

   <property-name>label</property-name>

   <property-class>java.lang.String</property-class>

   <value>Edit Key Account</value>

  </managed-property>

  <managed-property>

   <property-name>viewId</property-name>

   <property-class>java.lang.String</property-class>

   <value>/kape_editKeyAccount.xhtml</value>

  </managed-property>

 </managed-bean>

 

But I want to be able to use action methods instead of outcomes in the configuration, because
I have to do initialization work before showing some of my screens. 

 

  <managed-property>

   <property-name>action</property-name>

   <property-class>java.lang.String</property-class>

   <value>#{keyAccountProfileEditorController.showSearchKeyAccount}</value>

  </managed-property>

 

But if I try to define a method binding in the action property of the managed bean I get this
exception:

 

Caused by: javax.faces.FacesException: Property action references object in a scope with shorter
lifetime than the target scope none

      at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:164)

 

The reason is clear. The managed bean keyAccountProfileEditorController is on session scope
an the navigation is defined in scope none. But even if I switch all navigation items to the
session scope I get exceptions because the engine tries to evaluate the expression as a bean
property and not as a method binding. So the engine tries to find a method getShowSearchKeyAccount
in my controller bean. Is there a workaround to realize what I want to do or do I have to
rethink about my design.

 

Regards

Jochen

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message