Please help me. Is there a way how I can use a collection which is shared between all the Servlet instances?
I know I can save a string in HttpRequestContext but how can I store a collection? I know I could use a database but I'd prefer to store everything in memory
public class Servlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
context.setAttribute("someValue", "aValue");
// Want to use collection here
}
}
Thank you for your answers.