What is the difference between callling a RequestDispatcher
using ServletRequest and ServletContext?

Answer Posted / prachetash

RequestDispatcher rd = request.getRequestDispatcher("result.jsp")

This is relative path, becoz there is no "/" slash.Container looks in same logical path.

RequestDispatcher rd = getServletContext.getRequestDispatcher("/result.jsp")

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I send user authentication information while making URL Connection?

541


What are the functions of an intercepting filter?

488


Why do we have servlet filters?

595


How to get the path of servlet in the server?

532


What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?

563






Explain servlet life cycle?

613


Explain the different ways for servlet authentication?

528


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

607


Whether thread can be used in servlets?

728


The code in a finally clause will never fail to execute, right?

599


Can you use javascript in servlets?

598


What is load-on-startup in servlet?

580


Can you explain in detail 'javax.servlet' package?

545


Is servlet a controller?

573


What are important features of Servlet 3?

593