Pregunta

I am migrating my project to GWT. I load some values from database when the server starts. I want to achieve that with GWT (when I run my application in Eclipse - Run as web application). This is how I am doing currently with Tomcat server.

public class StartupListner implements ServletContextListener{

   @Override
   public void contextDestroyed(ServletContextEvent arg0) {
      // TODO Auto-generated method stub

   }

   @Override
   public void contextInitialized(ServletContextEvent arg0) {
      // TODO Auto-generated method stub
      try {
          Cache.ruleMap = DatabaseHelper.getConfiguredRules();
          Cache.customerRules = DatabaseHelper.getCustomerRules();
      }catch (Exception e){

     }  
 }
¿Fue útil?

Solución

Did you forget to put the listener in web.xml?

GWT applications are the same as any java web application: it relies on the servlet technology. On the server side, nothing changes : the environment is the same

Otros consejos

GWT documentation is a good place to start:

http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top