tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael" <tom...@meinsenf.at>
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
michi
 
 
>
>Michael,
>
>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.
>
>Ulf
>
>-----Original Message-----
>From: Michael [mailto:tomcat@meinsenf.at]
>Sent: Wednesday, November 21, 2001 11:34 AM
>To: tomcat-user@jakarta.apache.org
>Subject: ServletContext - PLS HELP!!
>
>
>
>Hi!
>
>
>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:
>config.getServletContext().getAttribute("test")
>but not
>request.getAttribute("test")
>WHY???
>
>
>how to access this attribute if I only know the HttpServletRequest-object
>but not the HttpServlet-object, though I know the contextpath
>(request.getContextPath())???
>
>thanks
>michi
Mime
View raw message