Thursday, February 1, 2007

What method used to add a jsp to the servlet?

The RequestDispatcher.include (req, resp) is used to add a jsp to the
Servlet.


SOURCE : www.referjava.com

what is the need of super.init (config) in servlets

This will call the super class init method to initialize the object by config.
b. Basically super.init () method should be used whenever u is overriding the init method.... else i don’t think there is any necessity.


SOURCE : www.referjava.com

importance of deployment descriptor in servlet?

. Deployment descriptor file contain the resources available to the bean) what type of transactions that bean is using, name of home interface etc

b. The deployment descriptor is not confined to servlets. It belongs to the application. The deployment descriptor basically tell the container where to look out for the resources, which patterns to follow, how are the resources mapped etc


SOURCE : www.referjava.com

.When you have action=get?

By default, every request sent is by GET. Only when we explicitly mention that the method is post, is the request sent by post. click meOn clicking the above link, the data is send by get method. Here, when we submit the form, the data is sent via the post method


SOURCE : www.referjava.com

. Can an init (ServletConfig config) method be overriden in servlets?

This cannot be overriden.

b. The init () method of servlet can be overridden. Remember the init () method is overloaded in the GenericServlet class. But the difference lies in which init method are u calling. If you override the init (ServletConfig config) method, then you will have to call explicitly super.init(config) inside your code. If you override the init () method, then u don’t have to call the super.init () method explicitly


SOURCE : www.referjava.com

How will u pass the argument from one servlet to another servlet?

. By Request dispatching.
b. we can use forward and include of request dispatcher and the arguments would be request and response for these methods


SOURCE : www.referjava.com

What is the super class of all servlets?

The Class GenericServlet is the super class of all known servlets. This class is extended by other classes like HttpServlet. The GenericServlet class is protocol independent.


SOURCE : www.referjava.com