-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hai,
how can i read a session using a servlet, after it set with a ZK
this code is to use a standard httpsession using a ZK
HttpSession session = (HttpSession)(Executions.getCurrent()).getDesktop().getSession().getNativeSession();
session.setAttribute("key",userObject);
but when i try to read a that value using this :
HttpSession session = req.getSession(true);
UserObject userObj = (UserObject)session.getAttribute("key");
if (userObj != null){
session.setAttribute("key", userObj);
session.setMaxInactiveInterval(-1);
}
userObj always return null value. What happen ?
TIA,
Andy Susanto
HttpSession session = (HttpSession)(Executions.getCurrent()).getDesktop().getSession().getNativeSession(); session.setAttribute("key",userObject); System.out.println( "Wrote to session:" + session.getId() ) ;
HttpSession session = req.getSession(true); if ( session.isNew() ) System.out.println( "Hi! I'm a new session:" + session.getId() ) ; else System.out.println( "Hi! I'm old session:" + session.getId() ) ;
Hai,
yes i got different session id
ZK 9FEB16C85A02835870DA62000E53A091
standard AAA25BC04CB9F42280198BA850738B83
how can get a session id from a ZK ?
TIA,
Andy Susanto
Something's invalidating the session and causing your HttpSession session = req.getSession(true); to think it needs to create a new one. Having not seen all your code, it's hard to say. You should be able to boil it down to very minimal code to either find out what the problem is or have a shareable set of code to file with a bug report.
Hai,
i just use a simple code
first create a servlet with a button, button action only create a session and call ZK page.
at ZK page. just create a button, and the action just put a session then call a servlet page.
for the first try it is ok, try to second you will get a different session ID
just like that. i am using zk 3.6.4
Regards,
Andy Susanto
Asked: 2010-04-08 09:00:37 +0800
Seen: 2,224 times
Last updated: Apr 11 '10