aspose file tools*
The moose likes Servlets and the fly likes Problem with ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with ServletContext" Watch "Problem with ServletContext" New topic
Author

Problem with ServletContext

Aleks V. Pascoal
Ranch Hand

Joined: Apr 21, 2002
Posts: 73
Why i can't use the getServletContext twice in the same Servlet? I used it in the init then in the doGet. The second time returns null.
Can anyone help me with that?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
aleksvp
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
Which init method did you use? If you used the one that takes a ServletConfig object as a parameter you have to call super.init(config). It is the init method that gets the ServletContext and makes it available.
If that's not the case then post some of our code that calls the methods and also your init method.


Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with ServletContext
 
Similar Threads
Cant use object from another class
Text box value is not being completely filled with request attribute
WA #1.....word association
The x900 effect ?
Posting to bump up my count...