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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -