문제

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