I have to implement below scenario :
redirect to another jsp page.
In above code segment, servlet2 must execute in background.
And control must immediately be redirected to jsp page without waiting for servlet 2 to complete.
Normally this can be implemented using threading.
But how will threading be implemented in servlets.
Factor the logic in servlet2 to it's own class which implements Runnable. You can then start that runnable from both servlet1 and servlet2.
This means I should implement runnable interface in servlet2. and then start it from servlet1. For this i will have to create object of servlet2 in servlet1.
Please comment if I am wrong
No. Don't make your servlets implement Runnable. Create a separate class that implements runnable and start that thread in both servlet1 and servlet2.
Within reason, you can start threads from a servlet just as from any application. And as with any application, consider using something like the Executors framework to manage your background tasks (link is to some info I've written in case helpful).