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

Setting application attribute

 
Joseph Sweet
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I need to set some application attribute in the very beginning whenever tomcat is being restarted.

Where should i put the code to be executed???

somthing like:



any ideas?

Thanks, Joseph
 
Nikhilesh Fonseca
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can put that application scope variable
on init method of oyur controller servlet.That is the sevlet ewhich load on start up as 1.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64186
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prior to the advent of context listeners, a load-on-startup servlet was frequently used to perform application-wide initialization, but a context listener is a much better way to do it now that they are available.

It is guarenteed that all context listeners are executed before any servlets are loaded or executed.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic