Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

extends attribute in page directive

 
hardy singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Every Servlet generated from jsp extends HttpServlet then why there is extends attribute in the page directive?
Thanks in advance
Hardy
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that we know that the servlet generated from a JSP could extend another class. This extended class might be the one that actually extends HttpServlet.
 
hardy singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no class that extends HttpServlet. In other words you mean to say that It will be our Cutomized class that extends HttpServlet.
thanks for reply
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you might find that the specific application server that you're using might insert it's own custom class that all it's compiled jsp extend.
Sean
 
hardy singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Sean for your reply,
If a application server gives a class which will be extended by generated servlet, then why there is extends attribute (either you use it or not extends attribute), application server will generate a servlet which will exetends a class.
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by hardy singh:
thanks Sean for your reply,
If a application server gives a class which will be extended by generated servlet, then why there is extends attribute (either you use it or not extends attribute), application server will generate a servlet which will exetends a class.

From the JSP 1.2 specification regarding the extends attribute of the page directive...

This attribute should not be used without careful
consideration as it restricts the ability of the JSP container to
provide specialized superclasses that may improve on the
quality of rendered service.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!