[b]RandomStringUtils类 [/b]
1 生成10位随机数字字母
[b]NumberUtils类[/b]
[b]ConvertUtils类[/b]
1 生成10位随机数字字母
RandomStringUtils.randomAlphanumeric(10);
[b]NumberUtils类[/b]
[b]ConvertUtils类[/b]
//BeanUtils对时间转换的初始化设置
ConvertUtils.register(new SqlDateConverter(null), java.sql.Date.class);
ConvertUtils.register(new Converter(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d");
SimpleDateFormat sdf_time = new SimpleDateFormat("yyyy-M-d H:m");
@SuppressWarnings("rawtypes")
public Object convert(Class type, Object value) {
if(value == null) return null;
if (value instanceof Date) return (value);
try {
return sdf_time.parse(value.toString());
} catch (ParseException e) {
try {
return sdf.parse(value.toString());
} catch (ParseException e1) {
return null;
}
}
}}, java.util.Date.class);