首先,解决导入项目没得对应java EE 5 libery问题:
Build Path=>configure Build Path...=>Libraries=>
Add Library...=>选择MyEclipse Libraries=>勾选上 Java EE 5 Libraries
值得注意的小地方(细节):
ctrl+1:强转快捷键
String hql = "from Student student where student.id ="+id+"";
Student 是对应的bean实体(实体大写则这个也大写);student.id是实体对应的属性,
如果是int类型,则为"+id+",如果是字符串就用'"+username+"';
错误1:Error creating bean with name 'managerAction' defined in
class path resource [conf/app-action.xml]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'managerService' of bean class [cn.edu.abtc.action.sys.ManagerAction]:
Bean property 'managerService' is not writable or has an invalid setter method.
Does the parameter type of the setter match the return type of the getter?
--解决:action里面有service属性并且get和set,service里面有dao和dao的get和set
错误2:mapping,不存在entity,就是hibernate映像文件路径不匹配
错误3:No result defined for action cn.edu.abtc.action.login.LoginAction
and result success
--解决:对应Action里面的对应方法没有返回值,匹配不到structs
错误4:Error setting expression 'lastdate' with value '[Ljava.lang.String;@159abf4'
java.lang.String cannot be cast to java.util.Date
--解决:类型转换出错,'lastdate' 是Timestamp型,而页面是String型,所以我把'lastdate'
设成Stirng型即可