File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes jspInit() is Tomcat specific? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jspInit() is Tomcat specific?" Watch "jspInit() is Tomcat specific?" New topic

jspInit() is Tomcat specific?

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
If suppose I write jspInit() method in declaration element of JSP:

If I use Tomcat then this method will be called from init() method of servlet that is going to be generate from this JSP. Something like this:

But If I deploy this on any other server (Web Logic or Web Sphere Application Server) then it's not necessary that this method will be called from init() method. Something like this:

Is everything is right?

[ December 07, 2005: Message edited by: Bear Bibeault ]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1519
jspInit is not just a Tomcat thing. Its part of the JSP specification, and has been from the beginning.

Does the jspInit() method get called in WebSphere/WebLogic? Does it do the System.out.println()?
Maybe the jspInit() is being called from somewhere else in those appservers?
It is sorta covered in the JavaRanch Style Guide.
subject: jspInit() is Tomcat specific?
jQuery in Action, 3rd edition