-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks to Paweł Wielgus I was turned on to the prospect of using a Custom Type Converter to handle a custom date problem.
To recap: I have a form where the user can insert into java.sql.Timestamp field either a date in the form yyyy-MM-dd HH:mm or just HH:mm. If the user keys only a time, there is another bean in the action that has a java.sql.Timestamp field whose date part will be used as a reference. There are four Timestamp fields that are associated: Timestamp call came in (which will be used as the reference) Timestamp call was picked up by tech Timestamp problem was solved by tech Timestamp tech is back at the office. To make date entry easier, I wanted the form filled out something like this: 2011-01-01 08:00 (call came in, assigned automatically) 08:10 09:00 09:20 with the idea that if no date was entered the '2011-01-01' from the call came in field would be used. My problem is how to get that reference Timestamp into a location where the custom type converter can pick it up. I've tried putting it into the session, but I'm getting a null value back with the getSession().get() call, I've tried looking in the valueStack, amongst other variations, but I have been unable to figure this out. Here is my code which shows that things work if I create a current Timestamp object: public Object convertFromString(Map context, String[] values, Class toClass) { Timestamp ts = null; System.out.println("OutageDateConverter.convertFromString " + values[0]); // ValueStack valueStack = (ValueStack)context.get(ValueStack.VALUE_STACK); // Timestamp ref = (Timestamp)valueStack.findValue("reportedOutage.reportedTimestamp"); Calendar calendar = Calendar.getInstance(); java.sql.Timestamp ref = new java.sql.Timestamp(calendar.getTime().getTime()); try { ts = com.valleyrec.webapps.outages.util.DateManager.ReferencedStringToTimestamp( ref, values[0] ); } catch (java.text.ParseException pe ) { throw new TypeConversionException(pe.getMessage()); } System.out.println("Value of the created timestamp is: " + ts); return ts; } Please forgive the hacked debugging code which is included. Can anyone point me to a possible solution? Any help would be greatly appreciated. Thanks! Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFNXHDmCFu3bIiwtTARAsiRAJ4pPL8GXbI8KeH2IfZVI6veEKTKFACfUoE4 wmE/O0KQxfmMoMBNO5APP1w= =K1J1 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org