http://530247683.iteye.com/blog/1045536


在insert的时候对于一些数据库中可以为空的值要指定jdbcType 。 对于时间类型,如果只记录年月日,jdbcType即可指定为Date。如果需要记录时分秒,则需要指定jdbcType为TIMESTAMP类型。

struts2对于Date类型的转换
XWorkBasicConverter类中默认用以下几种方式尝试转换从页面提交上来的Date字符串。如果不符合则需要自定义Converter( http://struts.apache.org/2.3.4/docs/type-conversion.html)
private  DateFormat[] getDateFormats(Locale locale) {
                DateFormat dt1 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, locale);
                DateFormat dt2 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale);
                DateFormat dt3 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);

                DateFormat d1 = DateFormat.getDateInstance(DateFormat.SHORT, locale);
                DateFormat d2 = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
                DateFormat d3 = DateFormat.getDateInstance(DateFormat.LONG, locale);

                DateFormat rfc3399 =  new  SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" );

                DateFormat[] dfs = {dt1, dt2, dt3, rfc3399, d1, d2, d3};  //added RFC 3339 date format (XW-473)
                 return  dfs;
        }