Chad,


I guess you can use the UIParameter object:





UIParameter parameter = new UIParameter();

parameter.setName("yourName");

parameter.setValue("theValue");



In your loop you would then add this to the lItem

lItem.getChildren().add(parameter);



And then you look it up in your ActionListener method like this:



FacesContext context = FacesContext.getCurrentInstance();

Map map = context.getExternalContext().getRequestParameterMap();

String key = (String) map.get("yourName ");



Regards,



Eivind





From: Chad Skinner [mailto:[EMAIL PROTECTED]
Sent: 14. august 2008 04:35
To: MyFaces Discussion
Subject: PanelNavigation2



I am trying to create a dynamic PanelNavigation Menu using the method
utilized in the examples. The problem I am having is that I need my
actionListener to be able to access an attribute that identifies the
current item and I don't see how to add an attribute to the
NavigationMenuItem.



For example, I have the facelet code:



<t:panelNavigation2 id="profileNavigation"

                    layout="list"

                    itemClass="mypage"

                    activeItemClass="selected"

                    disabledStyle="color:red">

   <t:navigationMenuItems id="navitems" value="#{mybean.menuItems}" />

</t:panelNavigation2>







My Bean contains the following Code similar to the following as I have
removed a lot of the code to simplify the example:



List<NavigationMenuItems> lMenuItems = new
ArrayList<NavigationMenuItem>();

for( Student lStudent : students ) {

   NavigationMenuItem lItem = new NavigationMenuItem(
lStudent.getName(), "#{myaction}");

   lItem.setActionListener("#{myActionListener}");

   lItem.setValue(lStudent.getName())

}



The problem is that when the user clicks on the menu Item the action
listener needs access to two pieces of information: 1) the student and
2) a display mode.



Can anyone tell me what I need to do to set attributes on the components
so that I can look them up in the actionListener.

Reply via email to