You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Use a DispatcherListener to get hooked up to event when a Struts2 Dispatcher gets initalized and destroyed. This is a useful place to associate customizable components like ConfigurationManager with a Dispatcher.

Example

  static {
     Dispatcher.addDispatcherListener(new DispatcherListener() {
         public void dispatcherInitialized(Dispatcher du) {
            // do something to Dispatcher after it is initialized eg.
            du.setConfigurationManager(....);
         }

         public void dispatcherDestroyed(Dispatcher du) {
            // do some cleanup after Dispatcher is destroyed.
         }
     });
  }
  • No labels