init()
doGet()
doPost()
destroy()
What are the different cases for using sendRedirect() vs. getRequestDispatcher()?
When you want to preserve the current request/response objects and transfer them to another resource WITHIN the context, you must use getRequestDispatcher or getNamedDispatcher.
If you want to dispatch to resources OUTSIDE the context, then you must use sendRedirect. In this case you won't be sending the original request/response objects, but you will be sending a header asking to the browser to issue a request to the new URL.
http://faqs.javabeat.net/servlet/java-servlets-interview-questions-faqs-8.php
0 Comments:
Post a Comment