Well , I am not sure how to debug into the session .
I printed out the session.getId() and session.sequence , after login success
, and back to the loginPage
Both are the identical ...
MySession s = (MySession) getSession();
s.getLoginData().setUser(u);
System.out.println("After login success , id = " + s.getId() + " , seq = " +
s.sequence);
s.dirty();
In LoginPage :
MySession ds = (MySession) getSession();
System.out.println("In login panel , id = " + ds.getId() + " , seq = " +
ds.sequence);
User u = s.getLoginData().getUser(); // still null
After login success , id = abcPhnwUGJlEO5BVFmuPr , seq = 25
In login panel , id = abcPhnwUGJlEO5BVFmuPr , seq = 25
I think the both sessions are the same...
2008/6/5 Maurice Marrink <[EMAIL PROTECTED]>:
> Hmm it is getting late and i may be missing something, but that should
> work.
> Can you check if you have a temporary session? that is the only
> logical explanation i can come up with at this time :)
> if it is it is replaced by a new session on each request, call bind()
> to fix that.
> if not you might want to debug session#requestDetached and check what
> happens there and if the session is still the same in the next
> request.
>
> Maurice
>
> On Wed, Jun 4, 2008 at 11:47 PM, smallufo <[EMAIL PROTECTED]> wrote:
> > Oops , thanks for your hint....
> >
> > But it seems not working ......
> >
> > User loginedUser = userDao.getUserFromLoginName(loginName);
> > if (loginedUser != null)
> > {
> > MySession mySession = (MySession) getSession();
> > mySession .getLoginData().setUser(loginedUser);
> > mySession .dirty(); //add this line
> > setResponsePage(LoginPage.class);
> > }
> >
> > In LoginPage :
> > User user = MySession.get().getLoginData().getUser();
> > Here , user is still null. Why ?
> >
> >
> >
> > 2008/6/5 Maurice Marrink <[EMAIL PROTECTED]>:
> >
> >> Mark the session as dirty. Wicket cannot detect if some property of a
> >> pojo has been updated in your session.
> >> By marking the session as dirty wicket will (re)save everything.
> >>
> >> Maurice
> >>
> >> On Wed, Jun 4, 2008 at 10:52 PM, smallufo <[EMAIL PROTECTED]> wrote:
> >> > Thank you .
> >> > It solves my confusion.
> >> > But I have another question.
> >> > It seems wicket can only handle "one-reference" composite session.
> >> > That is , a root session object , and a associated session object.
> >> > If the associating session object has another associating object , it
> >> will
> >> > not be saved/updated.
> >> >
> >> > for example :
> >> > MySession.get().getLocation().setCityName("Taipei")
> >> > it will automatically save the value.
> >> >
> >> > But if the Location has another associated object :
> >> > MySession.get().getLocation().getCity().setName("Taipei");
> >> > After reloading , the city's name is not updated.
> >> > It seems wicket cannot save the reference.
> >> >
> >> > I know maybe MySession.get().getLocation().setCity(new City(...)) can
> >> solve
> >> > this problem
> >> > But is this the only way ?
> >> >
> >> >
> >> >
> >> >
> >> > 2008/6/5 Eelco Hillenius <[EMAIL PROTECTED]>:
> >> >
> >> >> > My question is , if I don't want to use HttpSession (string
> property
> >> is
> >> >> > error-prone)
> >> >> > I prefer the wicket way.
> >> >> > I found if I go the wicket way , it results in the "composite
> session
> >> >> > object" , it is correct ?
> >> >> >
> >> >> > PageAsetting settingA =
> ((MySession)getSession()).getPageAsetting();
> >> >> > PageBsetting settingB =
> ((MySession)getSession()).getPageBsetting();
> >> >>
> >> >> Yeah, that looks good.
> >> >>
> >> >> Btw, in your session class you can do:
> >> >>
> >> >> public static MySession get() { return (MySession)Session.get(); }
> >> >>
> >> >> so that you can do:
> >> >>
> >> >> PageAsetting settingA = MySession.get().getPageAsetting();
> >> >>
> >> >> which is a bit nicer imho.
> >> >>
> >> >> > If I have more pages , more settings , I have to "hook" these
> setting
> >> >> > objects to the root session object .
> >> >> > Is it what wicket's favorable way ?
> >> >>
> >> >> Yeah, if you're sure these settings should be retained for the
> >> >> duration of the whole session, that's what you can do.
> >> >>
> >> >> Eelco
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>