1 16 17 package org.apache.tester; 18 19 20 import java.beans.PropertyEditorManager ; 21 import java.sql.Date ; 22 import javax.servlet.ServletContext ; 23 import javax.servlet.ServletContextEvent ; 24 import javax.servlet.ServletContextListener ; 25 26 27 34 35 public class ContextListener02 36 implements ServletContextListener { 37 38 39 private ServletContext context = null; 40 41 42 public void contextDestroyed(ServletContextEvent event) { 43 context.log("ContextListener02: contextDestroyed()"); 44 context = null; 45 } 46 47 public void contextInitialized(ServletContextEvent event) { 48 context = (ServletContext ) event.getSource(); 49 context.log("ContextListener02: contextInitialized()"); 50 PropertyEditorManager.registerEditor(Date .class, 51 DatePropertyEditor.class); 52 context.log("ContextListener02: getEditorSearchPath() -->"); 53 String search[] = PropertyEditorManager.getEditorSearchPath(); 54 if (search == null) 55 search = new String [0]; 56 for (int i = 0; i < search.length; i++) 57 context.log("ContextListener02: " + search[i]); 58 context.log("ContextListener02: findEditor() --> " + 59 PropertyEditorManager.findEditor(Date .class)); 60 61 } 62 63 64 } 65 | Popular Tags |