I'd use a ServletContextListener... Just implement that interface. You'd put your code into contextInitialized method. Then, declare your implemented class in web.xml in listener tags: <listener> <listener-class>your fully qualified class here</listener-class> </listener>
You'll be guaranteed to have your code executed before any requests are served to the client and it is only done once per application startup. NG. On Tue, Jan 5, 2010 at 9:53 AM, ojay <[email protected]> wrote: > Hi, > > I forgot a tiny thing in the web.xml :-) > > It's better to use the <load-on-startup>0</load-on-startup> option in > the web.xml so that the servlet will be started :-) > > On 5 Jan., 15:11, Qian Qiao <[email protected]> wrote: >> On Tue, Jan 5, 2010 at 22:08, ojay <[email protected]> wrote: >> > Hi, >> >> > I need to access my database in the server area of my gwt application. >> > Now I have the problem that i cannot init the database connection. I >> > am using hibernate to access my database, in my previous applications >> > (struts) I used the Datasource of the underlying tomcat to start and >> > database transcation with hibernate. Now with GWT 2.0 I want to use >> > the hosted mode and therefore I need to initialize my database >> > connection pool. Therefore I tried to create this pool with a servlet. >> > Now I have the problem that my servlet will not be started in the >> > hosted mode. >> >> > Can somebody explain where I can define in GWT to start a special >> > servlet at startup of the host mode? >> >> ehhh, web.xml maybe? >> >> -- >> Two things that are infinite, the universe and my stupidity, and I'm >> not sure about the universe. > > -- > > 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. > > > -- Thanks, NG -- 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.
