to the main page about the tutorial  INTERACTIVE WEB SERVICES WITH JAVA back up next

Listeners

- event handlers

Events:

Implement the appropriate interface, register your listener (in web.xml).

Example listener and deployment declaration:
public class DataListener implements ServletContextAttributeListener
{
    public void attributeReplaced(ServletContextAttributeEvent event)
    {
        if (event.getName().equals("some_data"))
	    updateSomeOtherData();
    }

    ...
}

<listener>
  <listener-class>DataListener</listener-class>
</listener>

Useful for

back COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next