In a Servlet ,I want to execute a method as a background process.I used this method inside the Servlet becase It use the
request object.So I create a Thread through a inner class inside the servlet. The Thread execute and works fine upto the servlet
has not been redirect to jsp,The moment it redirect the run() method from Thread returns NullPointerException.
So Here what I need
I want to execute the Thread with out depends the redirection of servlet.I mean as a backgroud process.In the Thread I have to use the request object of the Servlet.
What do you need the request object for? As Bill said, you can get all the information from it, pass those to the background job, and then let it do its work. Servlet API objects should only be used in the view layer, not in the deeper layers.