File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion about overriding jsp equivalent init()

 
Prithvi Sehgal
Ranch Hand
Posts: 774
  • 0
  • 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,
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2168
57
Android Chrome Eclipse IDE
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic