Hi, I have only read the first page of your post but from that I believe that your initialization of BeanUtil is the problem. By doing the call: BeanUtil.getPropertyEditor(Date.class); you actually force BeanUtil to fetch the editor from the PropertyEditorManager, and this will be the Webwork editor. BeanUtil then keeps a local cache of all found editors (because PropertyEditorManager can be slow), so it will never try to lookup the date editor in the PropertyEditorManager again. So, any other method of getting the BeanUtil class to initialize should have worked. You can for example create an instance of it, then register your editors with the PropertyEditorManager, and then finally you can call the BeanUtil.getPropertyEditor(Date.class) to verify that you get the expected editor.
For the next release we will add a register method to the BeanUtil class so that you can register FastPropertyEditors there, and then you won't have to care about initialisation order. (There were some posts concerning this about a week ago). Cheers, Dick Zetterberg ----- Original Message ----- From: "Jed Prentice" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 05, 2004 9:36 PM Subject: [OS-webwork] Custom Date Editor Not Invoked Hello, I wrote my own date editor class, and cannot figure out why it is not being used by WebWork. (Assume I need a custom date editor.) I can successfully register it with PropertyEditorManager, and verify that it is registered when my action goes to save an object with dates, but I'm not seeing the behavior I expect nor the print statements I put in my editor class for debugging (thinking of course that it was a problem with my editor...) I registered my date editor, DateTimeEditor, using PropertyManager.registerEditor() for java.util.Date from a static initializer in the base class of my action class, which extends ActionSupport and implements CommandDriven: static { System.out.println("~~~~~~~~~~~Registering Date/Money Editors~~~~~~~~~~~~~~"); BeanUtil.getPropertyEditor(Date.class); PropertyEditorManager.registerEditor(Date.class, DateTimeEditor.class); PropertyEditorManager.registerEditor(Date[].class, DateTimeEditor.class); PropertyEditorManager.registerEditor(Money.class, MoneyEditor.class); PropertyEditorManager.registerEditor(Money[].class, MoneyEditor.class); PropertyEditorManager.registerEditor(Percentage.class, PercentageEditor.class); PropertyEditorManager.registerEditor(Percentage[].class, PercentageEditor.class); } The call to webwork.util.BeanUtil.getPropertyEditor() forces BeanUtil to load and ensures that DateTimeEditor will overwrite webwork.util.editor.DateEditor. Otherwise, BeanUtil is not loaded until it is used, after DateTimeEditor was registered, and BeanUtil's static intializer replaces DateTimeEditor with webwork.util.editor.DateEditor. Print statements in the save method/command of my action class confirm that my date editor is registered with PropertyEditorManager for dates. I also tried registering my date editor with PropertyEditorManager using java.sql.Date, just for the hell of it, knowing that it is possible that a date displayed on a page may actually be an instance of java.sql.Date; no dice. BTW, the editors I wrote for Money and Percentage register fine and get invoked correctly through the framework. I bet the fact that I wrote those classes means there is no way there is any kind of default property editor around to mess things up. Interestingly, if I ask the property descriptor associated with a date for its editor class, e.g., new PropertyDescriptor("startDate", TimeInterval.class).getEditorClass(), where TimeInterval is a class containing startDate, declared as java.util.Date, I get null. Before you go "ah-HA", note that I also get the same result when I ask for the property descriptor for a property of class Money or Percentage, whose custom editors work fine. I have to conclude that this is not relevant, but I could be wrong. My objects are all populated with the following code: protected void populate(Object o) throws ResultException { Map parameters = ActionContext.getContext().getParameters(); for (Iterator keys = parameters.keySet().iterator(); keys.hasNext();) { String key = (String)keys.next(); try { BeanUtil.setProperty(key, parameters.get(key), o); } catch (IllegalArgumentException e) { e.printStackTrace(); addError(key, e.getMessage()); } } if (invalidInput()) throw new ResultException(INPUT); } Any ideas? Jed Prentice ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork