Revision history [back]

click to hide/show revision 1
initial version

answered 2013-03-26 09:51:16 +0800

benbai gravatar image benbai

http://www.zkoss.org

There is only one session for all tabs and each tab has different desktop, you can check it by the sample below:

<zk xmlns:w="client">
    <textbox id="tbx" rows="6" width="300px" />
    <button label="test">
        <attribute name="onClick"><![CDATA[
            tbx.setValue("desktop: " + self.getDesktop() + 
                    "\n\nsession: " + Sessions.getCurrent().getNativeSession());
        ]]></attribute>
    </button>
</zk>

Regarding your issue, there are several possible ways to go:

1. Store data with some UNIQUE ids, e.g., Session.setAttribute("USER_NAME", userName); This way you will always keep only one instance of specific data in session.

2. Pass variables by Execution (request scope), e.g., Executions.getCurrent().setAttribute(...) This way those data will only exists while making a request.

3. Handle some specific class (e.g., a map) to store data your self.

4. Avoid opening multiple tabs, I've done a simple sample: full project at github article at my blog

There is only one session for all tabs and each tab has different desktop, you can check it by the sample below:

<zk xmlns:w="client">
    <textbox id="tbx" rows="6" width="300px" />
    <button label="test">
        <attribute name="onClick"><![CDATA[
            tbx.setValue("desktop: " + self.getDesktop() + 
                    "\n\nsession: " + Sessions.getCurrent().getNativeSession());
        ]]></attribute>
    </button>
</zk>

Regarding your issue, there are several possible ways to go:

1. Store data with some UNIQUE ids, e.g., Session.setAttribute("USER_NAME", userName); This way you will always keep only one instance of specific data in session.

2. Pass variables by Execution (request scope), e.g., Executions.getCurrent().setAttribute(...) This way those data will only exists while making a request.

3. Handle some specific class (e.g., a map) to store data your self.

4. Avoid opening multiple tabs, I've done a simple sample: sample:

full project at github

article at my blog

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