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){

     }  
 }
有帮助吗?

解决方案

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

其他提示

GWT documentation is a good place to start:

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top