Java JSB and Servlets Question and Answers

1. What are the life cycle methods of JSP?
  Life cycle methods of JSP are
  • jspInit(): The container calls the jspInit() to initialize the servlet instance. it is called before any other method and is called only once for a servlet instance.
  • jspService(): The container calls the _jspservice() for each request and it passes the request and the response objects.
  • jspService() method can't be overridden.
  • jspDestroy(): The container calls this when its instance is about to be destroyed.
  • The jspInit() and jspDestroy() methods can be overridden within a JSP page.
 
Your Name Your Email-ID
Your Answer
2. What is JSP?
 
  • Java Server Pages (JSP) technology is the Java platform technology for delivering dynamic content to web clients in a portable, secure and well defined way.
  • The Java Server Pages specification extends the Java Servlet API to provide web application developers.
 
Your Name Your Email-ID
Your Answer
3. What is the role of JSP in MVC model?
 
  • JSP is mostly to develop the user interface.
  • It plays the role of view in the MVC model.
 
Your Name Your Email-ID
Your Answer
4. What is a servlet?
 
  • Java servlet are server side components that provides a powerful mechanism for developing server side of web application.
  • Earlier CGI was developed to provide server side capabilities to the web applications.
  • Although CGI played a major role in the explosion of the Internet, its performance, scalability and reusability issues make it less than optimal solutions.
  • Java Servlets changes all that. Built from ground up using Sun's write once run anywhere technology java servlets provide excellent framework for server side processing.
 
Your Name Your Email-ID
Your Answer
123456789101112131415


Page 1 of 15