In this section, you will learn about dispatch method of AsyncContext Interface.
The AsyncContext Interface dispatch() method is of two types :
Given below a sample snippet using dispatch() method :
Consider a scenario where we have three Servlets - X , Y and Z which have URLs : /x , /y & /z :
Within Servlet X, we have :
request.getRequestDispatcher("/x").forward(request, response);
Within Servlet Y, we have :
request.getRequestDispatcher("/y").forward(request, response)
Within Servlet Z, we have following two statements :
request.startAsync().dispatch(); // to /y request.startAsync(request, response).dispatch(); // to /z
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: AsyncContext Interface dispatch method
Post your Comment