Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Confusion about overriding jsp equivalent init()  RSS feed

 
Ranch Hand
Posts: 774
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here is a exam watch from david bridge water book and i am unable to understand what it means, please help


If you want to harness jspInit() and jspDestroy() for your own setup and tear-down processes,
you can—by overriding either or both in a JSP declaration, which we explore a little later in this chapter. What if you
decided to override the servlet equivalents, init(ServletConfig config) and destroy()? Well, the JSP spec says
you can’t and mustn’t do this. Most JSP container providers prevent this happening by making all Servlet interface methods
fi nal in the base JSP servlet that they provide—your generated JSP servlet that inherits from this can’t possibly override
them. And while on the subject of overriding, you can’t override _jspService() either. This method represents your page source
in Java code form—it’s up to the clever container’s page generators to worry about the implementation and generation of this
method for each individual JSP. It makes no sense for you to override it within the JSP page itself.


Any points would be helpful.
Thanks,
 
Creator of Enthuware JWS+ V6
Posts: 3189
276
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prithvi,

It just tells you that (if you really want to) you can override the jspInit() and jspDestroy() methods but you can't override the Servlets equivalents (although a JSP is a Servlet). Furthermore remember that your JSP is generated into a Servlet, and this is what the API tells you:

The _jspService()method corresponds to the body of the JSP page. This method is defined automatically by the JSP container and should never be defined by the JSP page author.



Regards,
Frits
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!