How many ways are available to ger RequestDispatcher object?
Answer Posted / seshendra
There are three ways to get RequestDispatcher object in the
servlet.
1. calling the getRequestDispatcher(String path) method on
ServletRequest.
RequestDispatcher rd=request.getRequestDispatcher(String path);
2. By getRequRequestDispatcher(String path) method on
ServletContext.
RequestDispatcher rd=context.getRequestDispatcher(String path);
3.by calling getNamedDispatcher(servlet logical name)on
ServletContext object
RequestDispatcher rd=context.getNamedDispatcher(servlet
logical name)
Is This Answer Correct ? | 15 Yes | 0 No |
Post New Answer View All Answers
What are the type of protocols used in httpservlet?
Why do we need servlet filter?
How can you use a servlet to generate a plain text instead of html?
How do you load an image in a Servlet?
How to get the IP address of client in servlet?
What is meant by cookies?
How servlets are deployed in java?
What is Servlets and explain the advantages of Servlet life cycle?
Can we fetch the attributes related to a servlet on a different servlet?
Can we use threads in Servlets?
What is servlet configuration?
What are the types of servlets? Explain
Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
What is difference between cookies and httpsession?
Why is httpservlet declared abstract?