You can write a startup servlet that has an init method. In your web.xml add the <load-on-startup> element to your servlet entry.
With regards to GWT hosted mode I also had problems with init servlets/ context listeners. Matt On Jan 9, 10:36 am, Brad Larson <[email protected]> wrote: > Thanks jhulford! > > A servlet context listener seems to be the perfect solution. Is there > a GWT-approved way to register one with the hosted-mode Tomcat > server? I searched the forums a bit, but only found a few > hacks:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa... > > Thanks! > -Brad > > On Jan 9, 8:29 am, jhulford <[email protected]> wrote: > > > You can use a servlet context listener to initialize your application > > too. > > > On Jan 8, 12:20 pm, Brad Larson <[email protected]> wrote: > > > > Hello friends, > > > > What is the best way to run code on my server when my servlet is > > > loaded? I'd like to do some database initialization work which the > > > servlet is expecting. I could use a static variable in the servlet to > > > see if it is being ran for the first time, and do the init there, but > > > that seems like a hack to me. > > > > I have googled around and found a couple references to > > > ServletContextAttributeListener, but that seems like just as big of a > > > hack. Is there a GWT-approved method for doing anything like this? > > > > Thanks! > > > -Brad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
