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

Does servlet have main method?

678


How can we invoke another servlet in a different application?

699


What is called Scriptlet?

553


Why servlet is faster than jsp?

559


How we can get ip address of client in servlet?

532






Why the container loads server at the application startup and how?

575


What is the difference between Servlets and Applets?

539


Can we fetch the attributes related to a servlet on a different servlet?

626


how many jsp scripting elements are there and what are those?

538


How to rectify errors in java servlet while compilation?

514


What do you mean by session tracking?

665


Why is servlet used?

676


Which event is fired at the time of project deployment and undeployment?

779


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

618


Write the code to get the server information in servlet.

563