Simpling loading a jsf into an existing page via a menuitem

Hi,

What I'm trying to do is really elementary. Not sure why I'm having so much difficulty.

I have a menu:

<b:menuPopUpItem label="Go to Locations">
<e:handler event="click">
  <c:load url="locations.jsf" mode="replaceChildren" destination="id('workArea')"/>
</b:menuPopUpItem>

workArea is defined as:

<bjsf:panel id="workArea">
..
</bjsf:panel>

Right now, my locations.jsf file is defined as:

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://www.backbase.com/2007/jsf" prefix="bjsf"%>

<f:subview id="workArea">
 
...
</f:subview>

If I do something really simple in the subview, I get a "Multiple ID Occurences". I assume this is because whatever is being replaced isn't being destoryed propery.

If I do something more complex, I get an XML parsing error to do with namespaces.

This should be dead simple.

Any helps is greatly appreciated.

loading a subview

Hi jblinick,

Please see below for an example on how to load a subview via a select event which is triggered by a bjsf:menuItem.

Index.jsp

<bjsf:application clientDebug="true">
<bjsf:panelLayout rows="5% *" fullScreen="true">

<bjsf:panel id="menuContainer">
<bjsf:menuBar id="menu">
<bjsf:menuItem itemLabel="File">
<bjsf:menuItem itemLabel="Open" selectListener="#{myBean.open}"/>
<bjsf:menuItem itemLabel="Save" id="menuSave" />
<bjsf:menuItem itemLabel="Export">
<bjsf:menuItem itemLabel="To Png" />
<bjsf:menuItem itemLabel="To Gif" />
</bjsf:menuItem>
</bjsf:menuItem>
<bjsf:menuItem itemLabel="Edit">
<bjsf:menuItem itemLabel="Cut" />
<bjsf:menuItem itemLabel="Copy" />
<bjsf:menuItem itemLabel="Paste" />
</bjsf:menuItem>
</bjsf:menuBar>
</bjsf:panel>

<bjsf:panel id="mainView" style="border: solid 1px grey;" />

</bjsf:panelLayout>

</bjsf:application>

View1.jsp

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://www.backbase.com/2007/jsf" prefix="bjsf"%>
<f:subview id="main">
<bjsf:view>
<bjsf:outputText value="Content goes here "></bjsf:outputText>
</bjsf:view>
</f:subview>

myBean.java

public void open(SelectEvent event) {
BackbaseContext context = BackbaseContext.getCurrentInstance();
System.out.println(event.getComponent().getId());
UIComponent destComp = ComponentUtils.findComponent(context.getViewRoot(),"mainView");
context.loadView(destComp, "view1.jsp", "replacechildren");
}

Hope this helps,

-Senaka

Thanks

Thanks Senaka, I appreciate it.