如题,错误如下:
ERROR org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception occurred during processing request: Unparseable date: ""
java.text.ParseException: Unparseable date: ""
at java.text.DateFormat.parse(Unknown Source) ~[?:1.8.0_51]
at action.StudentsAction.save(StudentsAction.java:67) ~[StudentsAction.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:870) ~[ognl-3.0.6.jar:?]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293) ~[ognl-3.0.6.jar:?]
...
而且点出某一个学生信息的时候没有生日,点击也不会出现小日历可以选择,有哪位高手帮忙看看,谢谢。
你那个页面里这么写
<tr>
<td>出生日期:</td>
<td><input name="birthday" type="text" id="control_date" size="20"
maxlength="10" onclick="new Calendar().show(this);" readonly="readonly" />
</td>
</tr>
action里 前台传过来的格式是这样的:yyyy-MM-DD
做一个类型转换
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd" );
Date date = format.parse(birthday);
stu.setBirthday(date);