1.action book!query not found in the namespace
解决:Window–>Preference–>Myeclipse –>Validation –>去掉struts2 Validator后的Build列勾确认
这个是用来验证文件的
2.HTTP Status 500 - Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
解决:Date date = new Date();//获得系统时间.
String nowTime = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”).format(date);//将时间格式转换成符合Timestamp要求的格式.
Timestamp g = Timestamp.valueOf(nowTime);//把时间转换
yyyy-MM-dd HH:mm:ss格式应为这个形式;
3.java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
解决:找不到数据,重新把数据库表信息更新
4.struts中出现 Action book!query cannot be found in the namespace struts.xml /Library/src line 26 Struts 2 Problem
解决方案:Window–>Preference–>Myeclipse –>Validation –>去掉struts2 Validator后的Build列勾确认
5.java.lang.ClassCastException: com.su.domain.Classes_$$_javassist_1 cannot be
配置Classes和Student之间多对多的注释时,由于fetch=FetchType.EAGER写成了fetch=FetchType.LAZY,因此,报错
解决:LAZY改成EAGER
PS:FetchType.LAZY:延迟加载
FetchType.EAGER:急加载
急加载就好理解了,在加载一个实体的时候,其中定义是急加载的的属性(property)和字段(field)会立即从数据库中加载
延迟加载,顾名思义,就是在访问具体的属性时才从数据库中加载
6. Unable to locate parent package [json-default] for [class com.su.web.action.StudentAction]
原因:缺少json包
解决:在lib下放入strutds-json-plugin-2.3.24.1.jar包
7.There is no Action mapped for namespace [/] and action name [addstu] associated with context
原因:未配置name=”addstu”的action
解决:先建立action,然后再进行配置