Vortex (2) [Avatar] Offline
#1
Hi Friends,

First of all. Thank you for this excellent book. It helped me a lot figuring out JSF programming.

However I have a little difficulty with the UINavigator control. If I add NavigatorItems from a bean UINavigatorList never gets updated on the selectedItem property.

Thus, when I click a runtime added NavigatorItem the method UINavigatorList.getSelectedItem() returns null, and because of that the UINavigator.getAction exits

Strange thing is, if I add the NavigatorItems by coding them with UINavigatorItem tags in my page, everything works fine! What am I missing?

bean code (I bind it to a UINavigator by setting value="#{SubmenuBean.items}":

public NavigatorItemList getItems(){
items = new NavigatorItemList();
String action = "#{SubmenuBean.handleNavigation}"
items.add(new NavigatorItem("inbox", "Inbox66", "images/inbox.gif",
action, null, false, false));
return items;
}

[edit] I traced the error a bit further; The UINavigator.submittedItem is properly set. However the NavigatorItemList.selectedItem still remains null[/edit]

Message was edited by:
Vortex
Vortex (2) [Avatar] Offline
#2
Re: adding NavigatorItems at runtime getSelectedItem() returns null
I solved this by making NavigatorItemList.selectedItem a static slot. When the method UINavigator.setSubmittedItem gets fired I set the selectedItem of the NavigatorItemList also. It works, but it isn't a clean solution. Maybe one of you has a better implementation?