-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I trying to do a dynamic include of a zul page, in a section of Jsp page in my struts-tiles application. My main.jsp is included as center tile in a jsp page. Main.jsp itself has borderlayout and is divided into 3 parts, top portion includes headerMenu, left portion displays a tree and center portion defines actual content from database. So when a user clicks on nodes of tree, the content in the center portion changes dynamically corresponding to the tree node. I started developing this functionality using zul framework and was working fine. But now i need to integrate with my existing application that uses struts tiles framework. So i converted my zul pages to JSP pages using jsp-zk tags. And things are not working.
When i request Main.jsp, i could see the header portion and tree portion well, but in the center portion, i see message like "The requested resource (/vp/content/zk/$%7bcontentSrc%7d) is not available"
/vp is my context path of web application. and jsp and zul files are placed in /vp/content/zk/ folder.
when i try to click any node of the tree , to see the corresponding zul file displayed in center, I got this exception
java.lang.ClassCastException: java.lang.String
>> at org.zkoss.zk.ui.event.SelectEvent.getSelectEvent(SelectEvent.java:60)
>> at org.zkoss.zul.Tree.service(Tree.java:1892)
>> at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:659)
>> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1279)
>> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1058)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:561)
My files look like ..
Main.jsp
--------------
<z:page id="ntMain" >
<z:borderlayout id="mainWin" height="640px" >
<z:north flex="true" maxsize="250" splittable="false">
<z:include id="menuArea" src="ntMenu.zul" />
</z:north>
<z:west id="west" title="Switch POP List" size="18%" maxsize="250" splittable="true" collapsible="true" >
<z:include id="treeArea" src="ntTree.zul" />
</z:west>
<z:center border="none" flex="true" autoscroll="false">
<z:include id="contentArea" src="${contentSrc}" />
</z:center>
</z:borderlayout>
ntTree.zul
---------------
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<tree id="treeWin" height="100%" vflex ="true" zclass="z-filetree" apply="teo.nt.ui.TreeToc" >
<treecols />
</tree>
</zk>
teo.nt.ui.TreeToc.java
--------------------------------
public class TreeToc extends GenericForwardComposer{
private Tree treeWin;
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
treeWindowInit();
}
private void treeWindowInit() {
User user = (User) Sessions.getCurrent().getAttribute("user");
RootNode root = new RootNode();
root.setUserId(user.getId());
root.readChildren();
//create treemodel and assign root
ClientSiteTreeModel mtm = new ClientSiteTreeModel(root);
//create a TreeitemRenderer
ClientSiteTreeitemRenderer mtr = new ClientSiteTreeitemRenderer();
treeWin.setModel(mtm);
treeWin.setTreeitemRenderer(mtr);
Treeitem item = treeWin.getSelectedItem();
if(item.getValue().getClass().equals(SiteNode.class)){
//default selected Item
final Execution exec = Executions.getCurrent();
exec.setAttribute("contentSrc", "/siteMessage.zul");
EventQueues.lookup("EventQueue", EventQueues.DESKTOP, true)
.publish(new Event("onChangeSite", null,item.getId()));
}
}
public void onSelect(Event event) {
Treeitem item = treeWin.getSelectedItem();
Include inc = (Include)Executions.getCurrent().getDesktop().getPage("ntMain").getFellow("contentArea");
if (item != null) {
if(item.getValue().getClass().equals(GridViewNode.class)){
inc.setSrc("/Grid.zul");
EventQueues.lookup("EventQueue", EventQueues.DESKTOP, true)
.publish(new Event("onChangeGridView", null,item.getId()));
}else if(item.getValue().getClass().equals(SiteNode.class)){
inc.setSrc("/siteMessage.zul");
EventQueues.lookup("EventQueue", EventQueues.DESKTOP, true)
.publish(new Event("onChangeSite", null,item.getId()));
}else if(item.getValue().getClass().equals(StateNode.class)){
inc.setSrc("/stateMessage.zul");
EventQueues.lookup("EventQueue", EventQueues.DESKTOP, true)
.publish(new Event("onChangeState", null,item.getId()));
}
}
}
}
please help ..
HI
This issue is actually related to the Jboss server and existing code that i am using to integrate to zk framework.
I resolved this issue by myself, basically there was some issues in the javascript of existing code, and minor issues in depolyment descriptor of existing application.
mukesh
Asked: 2010-11-16 13:31:30 +0800
Seen: 526 times
Last updated: Dec 03 '10