How many ways are available to ger RequestDispatcher object?

Answer Posted / rice

There are two 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);

Is This Answer Correct ?    17 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between GenericServlet and HttpServlet?

565


How can an existing session be invalidated?

659


How is a servlet implemented in code?

566


How to get the current httpsession object?

649


What is the use of servletconfig interface?

554






Explain the architechure of a servlet?

602


What do you mean by default initialization in java servlet?

604


Why session tracking is needed?

582


What are the different session tracking techniques?

672


Given the request path below, which are context path, servlet path and path info?

543


What are the key methods that are involved in processing of http servlets?

624


How httpservlet is different from the genericservlet?

562


How can a servlet be used to generate plain text instead of html?

543


Why filter is used in servlet?

524


What is servlet instance?

540