java - @SessionAttribute not being set -
i need help. i'm using portlet app usual when have out of computer. when return, there's nullpointerexception. ok, why's that? hmm... session doesn't contain object should hold. so, i'm loosing here's how looked @ sessionattributes.
i have controller annotated so:
@sessionattributes({ some_attr })
then have method following signature:
@valid @modelattribute(some_attr) someobject someobject
and init method session attribute:
@modelattribute(some_attr) public someobject getsomeemptyobject() { return someutils.createsomeobject(); }
when debugged app @ point found out that:
- manually looking session, there's nothing in it
- form binded
someobject
so 2 big questions are:
- why doesn't spring set
someobject
session well? - when session invalidated, why wasn't
getsomeemptyobject()
called fill empty space?
thanks in forward!
have @ httpsessionbindinglistener , httpsessionattributelistener. if someobject class control, can implement httpsessionbindinglistener otherwise need httpsessionattributelistener.
this posting covers pretty well.
Comments
Post a Comment