-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hallo...
sory, i have a problem with message error "cannot access components by another desktop", anybody tell me how to fix the problem?... the error message show up when another user join the same application...
thx...
cheers...
It's the spec, not a bug.
A desktop is a browser tab for particular url.
What's your use scenario?
Maybe the following article can help you.
http://books.zkoss.org/wiki/Small_Talks/2009/August/ZK_5:_Chat_with_Event_Queue
main.zul:
<borderlayout id="main" apply="com.zkdesktop.web.MainLayoutComposer" width="100%" height="100%"> <north border="0" flex="true" margins="0,0,0,0"><label>Header</label></north> <center id="mainContent" autoscroll="true" border="normal" flex="true" margins="0,0,0,0"></center> <south border="0" flex="true" margins="0,0,0,0"><label>Footer</label> </south> </borderlayout>
MainLayoutComposer:
public class MainLayoutComposer extends GenericForwardComposer { .... public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); ZKPageUtil.setComponent(comp); Map<String, Object> params = new HashMap<String, Object>(); params.put("url", "main"); ZKPageUtil.sendRedirectURL("/pages/main.zul", params); } ..... }
ZKPageUtil:
public class ZKPageUtil { ..... public static void setComponent(Component component) { ZKPageUtil.component = component; } public static void sendRedirectURL(String filename, Map<String, Object> params) { String bookmark = (String) params.get("url"); try { if(component != null) { final Center mainContent = (Center) component.getRoot().getFellow("mainContent"); Components.removeAllChildren(mainContent); Executions.getCurrent().getDesktop().setBookmark(bookmark); Executions.createComponents(filename, mainContent, params); } } catch (Exception e) { _log.warn(e.getMessage(), e); } } .... }
This show error message: "You don't access components to another desktop". Maybe you know what is this problem...
Thanks.
Take the static declaration off your ZKPageUtil variables and methods, make an instance of it, store it in the session. The way you're doing it will never work because of the users coming into the app will be using each other's component which is assigned to a desktop that is unique to each user. This is a classic threading & web app session management issue.
Asked: 2011-04-24 21:09:09 +0800
Seen: 477 times
Last updated: May 03 '11