ServletContext and ServletRequest problem

Discussions

Web tier: servlets, JSP, Web frameworks: ServletContext and ServletRequest problem

  1. ServletContext and ServletRequest problem (2 messages)

    Hi,
    I have set some object in an initialization servlet using context.setAttribute() method. and I want to use that object in rest of the servlet. How can I acheive this..

    So, wat I need is a kind of relationship between Context and request object.
    Is this possible
    Please elp
    -Pratap
  2. yourServlet.getServletConfig().getServletContext() Do not forget to synchronize, this is a shared object.
  3. Unless all you're doing is reading it from the initialization on. Then you don't have to synchronize it.