http - Java servlet shared collection -


please me. there way how can use collection shared between servlet instances?

i know can save string in httprequestcontext how can store collection? know use database i'd prefer store in memory

public class servlet extends httpservlet {      public void doget(httpservletrequest request,                     httpservletresponse response)             throws servletexception, ioexception   {       context.setattribute("somevalue", "avalue");       //  want use collection here   }  } 

thank answers.

you can store in session - quite common. in public static collection in external class - sake of example util.mycollection. careful though, servlets should thread-safe , stateless, latter can considered anti-patttern - can lot of trouble doing this.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -