I've never tried, but I'm wondering if you could do the following: 1. Create a PropertyEditor for Timestamp. Use PropertyEditorSupport and override setAsText(String text). Make sure that the format of the text parameter is the same as the one you've got with fmt:parseDate 2. At the server startup (use a listener), register your PropertyEditor using the PropertyEditorManager.registerEditor(Class targetType, Class editorClass) 3. Try again
No, JSTL can't convert a java.util.Date into a java.sql.Timestamp automatically.
There are a couple of approaches I can think of: 1 - Add a setter for the property that takes a java.util.Date, and converts it to a timestamp internally. ie
2 - in the bean use java.util.Date rather than java.sql.Timestamp to declare the property. Convert it to a java.sql.Timestamp (if necessary) in the JDBC code. That separates the Bean from your data access layer.
Hope this helps, evnafets
Joined: Sep 06, 2006
Hi people. Thanks everyone for the sugestions.
It�s strange... When I try to show(get) a Timestamp attribute with JSTL it�s OK. No erros.
When I try to set....All my problems start....
I�ll try somethings....
Thank you all again!!!
Joined: Jul 06, 2005
Its because java.sql.Timestamp extends java.util.Date
So you can use a Timestamp object anywhere you use a Date (thus your display code works) However anywhere that specifes timestamp (such as your save code) will not accept just plain Date objects - only Timestamps.