i have unique situation in want store array of integers memory via post. think want fetch data later request.
this may seem strange, , weird, have use case, , in memory few seconds.
a simple example -- store array somearray = [1, 2, 3]; in sort of in memory storage post, , retrieve via in function.
since have access httpservletrequest
in controller, have invoke getsession
method:
httpsession session = request.getsession(false);
now have access session, can store, retrieve , remove data using relevant methods:
as said in comments, can omit getting session manually , send parameter method @controller
. taken this answer
@requestmapping...) public string processsubmit(..., httpsession session, ...) { object anattribute = session.getattribute("anattribute"); }
Comments
Post a Comment