Hi All, Thanks in advance. We are using Quartz schedular, Please tell me how to get a ServletContext object from the execute() method of Job. I have tried by Schedular extends HttpServlet implements Job, but the doGet() method is not calling.
Quartz is independent of the servlet environment. If you want your Job implementation to have access to the servlet context, then you need to make it available to it, e.g. in the constructor, or via a static method in some global object that returns it.
Thanks a lot for your reply. In my execute method I want to set one value in application scope which means need to set one value in ServletContext. But, as per you, I should get Servlet Context from some where,Please tell me some what clear.
I think you are talking about execute method of Job interface.You might want to write a class implementing Job interface and constructor of that taking servlet context as constructor parameter.
Originally posted by sridhar lakka: Thanks a lot for your reply. In my execute method I want to set one value in application scope which means need to set one value in ServletContext. But, as per you, I should get Servlet Context from some where,Please tell me some what clear.
Passing the ServletContext to the scheduled job doesn't look to be a good approach. What do you want to use from the ServletContext, in the job?