0

cannot access components by another desktop

asked 2011-04-24 21:09:09 +0800

rqabonk gravatar image rqabonk
15

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...

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2011-04-24 23:10:35 +0800

PeterKuo gravatar image PeterKuo
481 2

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

link publish delete flag offensive edit

answered 2011-04-24 23:46:00 +0800

rqabonk gravatar image rqabonk
15

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.

link publish delete flag offensive edit

answered 2011-05-02 23:06:37 +0800

PeterKuo gravatar image PeterKuo
481 2

In the following code,
ZKPageUtil.setComponent(comp);

I'm not sure if you used static method, field to store component from particular desktop.

link publish delete flag offensive edit

answered 2011-05-03 08:07:43 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

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.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-04-24 21:09:09 +0800

Seen: 477 times

Last updated: May 03 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More