-
FEATURED COMPONENTS
First time here? Check out the FAQ!
We developed our application with ZK and we use Session to pass some variables across different pages. We run into problem when user tries to use the application from multiple browser tabs. The data we stored in the session got messed up because it's the same session from different browser tabs. Any suggestions how to handle this situation?
Also could someone explains how ZK map its object model at multiple browser tab case? Do we get multiple desktops in the same session? Is there a "session" bound to a browser tab?
Thanks.
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:
Asked: 2013-03-18 17:25:27 +0800
Seen: 66 times
Last updated: Mar 26 '13
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status