tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael" <>
Subject Re : RE: ServletContext - PLS HELP!!
Date Wed, 21 Nov 2001 16:50:51 GMT
ok - I call a static method with the signature: "public static test(HttpServletRequest req)"
How can I access the servletcontext within this method???
I think this MUST be possible, because the HttpServletRequest-object has the getContextPath()-method
- so it knows the right context!!!!
if this is not possible: which object-reference do I have to give to my static-method???
thank you very much
>Request attributes and Context attributes are two separate things.
>You should not expect to store an item in one and retrieve it from
>the other. The servlet context can be gotten be calling getServletContext()
>from within a servlet.
>-----Original Message-----
>From: Michael []
>Sent: Wednesday, November 21, 2001 11:34 AM
>Subject: ServletContext - PLS HELP!!
>Can you help me, in what I'm doing wrong?
>I set an attribute in the servletcontext:in the initmethod!
>i can access the object using:
>but not
>how to access this attribute if I only know the HttpServletRequest-object
>but not the HttpServlet-object, though I know the contextpath
View raw message