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?
posted 14 years ago
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.