• Post Reply Bookmark Topic Watch Topic
  • New Topic

ASP to JSP conversion: events in the Global.asa file

 
Ant Swa
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am converting an ASP application to a JSP ( and servlets). My problem is where am I going to move the methods in Global.asa file(s) ( i.e. Session_OnStart() , Session_OnEnd(), and Application_OnStart() ).
Simply what I want is to trigger those events so that i am able to update some application wide variables. But do not know where the necessary changes should go.
Anybody got a clue ? please help.
:roll:
 
Chris Smith
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for notification on application start, you can install a servlet for that purpose with a web.xml directive to load it on startup, and put your initialization code in the servlet's init method.
In the servlet 2.3 spec, you can configure a listener to be called any time a session is created or destroyed. You specify the implementation class in your web.xml file, and handle the events in the listener class. In prior servlet versions, the best way to accomplish this was to make sure all your sessions got created in one place, and do the initialization there.
Chris
 
Ant Swa
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Chris, Can you explain little bit on the last part of your answer: "the best way to accomplish this was to make sure all your sessions got created in one place, and do the initialization there"

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!