Hi All, I'm trying to implement a model.attribute-level TypeConverter but I can't get it to work. I want to convert between "time" on a form (hh:mm) and a Date class in my model.
I'm using AppFuse 2.0 + Hibernate + Struts2 I have an "au.com.myapp.model.Shift" class that contains two Date attributes "startTime" and "endTime". Before I started creating a converter, I had a data entry form that displayed the startTime and endTime values as dates in text fields, as you'd expect. If I put time values in those fields (hh:mm) I get type conversion errors from the default date type converter, again as expected. I've followed the Struts documentation here: http://struts.apache.org/2.x/docs/type-conversion.html and created: - au.com.myapp.webapp.action.converters.BaseTypeConverter.java (Abstract type, extends org.apache.struts2.util.StrutsTypeConverter and provides base functionality like logging etc.) - au.com.myapp.webapp.action.converters.TimeTypeConverter.java (extends au.com.myapp.webapp.action.converters.BaseTypeConverter.java and implements convertFromString and convertToString methods (which convert between the Date object and the time string representation. - Shift-conversion.properties (in my src/main/resources directory) which contains the following two lines: startTime=au.com.myapp.webapp.action.converters.TimeTypeConverter endTime=au.com.myapp.webapp.action.converters.TimeTypeConverter >From my reading, that should be all I need to do. However, when I build and >run my app with this setup, the form's behaviour doesn't change. Further, I've put logging into the converter class (both the constructor and the methods) and it appears it's never called. Is there some other undocumented thing I need to do, or have I misunderstood the documentation? TIA, Rob Hills Waikiki, Western Australia Mobile +61 (412) 904-357 Fax: +61 (8) 9529-2137 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
