• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jspInit() method

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is jspInit() method of a JSP equivalent of the init(ServletConfig) method of a servlet? Does is execute only once when the JSP is initialized?
I want to initialize a database connection pooling in my JSPs and wondering if this is a good place to do this.
Thx.
Ulvi.
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jspInit() method is on the JspPage interface that must be implemented by servlet classes generated from JSP pages. These servlet classes are automatcically generated by the JSP Compiler on the Application Server so (AFAIK) you don't really have much controller over what gets placed in this method.
It sounds like you are trying to put too much logic and code into the JSP page. I would probably use another method to create you connection pool, maybe a servlet that is loaded on startup that then invokes a method on a class in the business tier that actually creates and manages the connection pool.
HTH
Andy
 
reply
    Bookmark Topic Watch Topic
  • New Topic