Hi,
I am having a problem with dynamic navigation. I may be ahead of myself in my
approach -- a lot of this is new for me. Maybe someone can help me.
In a nutshell - the issue is I can't figure out where to instantiate and update
a bean property such that my JSF page renders one and only subview with a
jsp:include. This is why I started with the subject question--when are bean
properties evaluated?
More details, my main page includes a header.jsp, and it has several subviews
with the rendered attribute bound to a managed bean. So, this:
<f:view>
<jsp:include page=/header.jsp"/>
<f:subview id="resourcesSubView"
rendered="#{!pageViewBean.showResourcesView}"> <jsp:include page="resourceViewGreeting.jsp"/>
</f:subview>
<f:subview id="configsSubView"
rendered="#{!pageViewBean.showConfigView}"> <jsp:include page="configViewGreeting.jsp"/>
</f:subview>
</f:view>
I want only one subview to be shown at a time, the one with rendered = true.
The object which knows what the user selection is exists in header.jsp. That
object is a tabbed panel (WebGalileoFaces component). It made sense to me to
then have the tabbed panel manage the properties. Here's the tab event handler
// this object knows what is selected, update bean here
public void processTabSelected(TabSelectedEvent event)
throws AbortProcessingException {
PageViewBean bean = new PageViewBean();
FacesTabbedPanelImpl tabbedPanel = (FacesTabbedPanelImpl) comp;
ListSelectionModel model = tabbedPanel.getListSelectionModel();
int selection = model.getLastSelection();
if (selection == 0) { LOG.info("MenuTabPanel: selection=" + 0); pageViewBean.setShowResourcesView(true); // don't show
} else if (selection == 1) { LOG.info("MenuTabPanel: selection=" + 1); pageViewBean.setShowConfigView(false); // show this
}
}
This is not having the effect I am aiming for--the bean properties would be
updated so the right include page would be rendered.
I could go on about all the things I've tried...but I don't want this post to
be any longer. I'd really appreciate anyone's time on this.
Thanks,
-L