Java J2ee Tutorials

Java Questions

Sunday, April 22, 2012


1. What is the difference between ServletContext and ServletConfig?
Both are interfaces. The servlet engine implements the ServletConfig interface in order to pass configuration information to a servlet. The server passes an object that implements the ServletConfig interface to the servlet's init() method.
The ServletContext interface provides information to servlets regarding the environment in which they are
running. It also provides standard way for servlets to write events to a log file.

2.What are forward & include methods? Why these are used? 
Both forward() and include() are concrete methods of the RequestDispatcher class in the Servlet context. forward() - this method is used to show a different resource in place of the servlet originally requested.

Free Career Predictions

0 comments:

Post a Comment