Invalid property 'teacherInfoService' of bean class [com.teacherInfo.struts.action.DisplayAction]: No property 'teacherInfoService' found 这个action里面用了'teacherInfoService'这个服务类 <property name="teacherInfoService"> <ref local="teacherInfoService" /> 'teacherInfoService'这个对象在action中是否存在并具有相应的setter方法 'teacherInfoService'这个在配置文件中是否存在
楼上说得是,首先你要清晰你的struts和spring配置,就是数据和处理的配置问题,第一,我想你这里的配置都是相对独立(当然,其实都是融合在一起的,只是换种说法)的,所以,struts配置的是转向加上一些功能问题,spring是用来连接数据的,所以这里你要清晰,struts配置转向,spring配置数据连接.所以,这里明显是数据配置有问题, Servlet.service() for servlet action threw exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/display' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'teacherInfoService' of bean class [com.teacherInfo.struts.action.DisplayAction]: No property 'teacherInfoService' found你所需要的东西,可以分开配一下,用import 或者是include等等,这样将文件分开,你也可以看得清楚, 其次,找问题,可以看问题提示,因为它至少是指向了一些问题的地方,当然不一定就是这里的问题,但是大部分是八九不离十了. 这里,还有就是,前后台所需要的东西就如楼上说的,需要get和set ,这个就看你需要了,取得或者是设置,多看看就清晰了,
这个action里面用了'teacherInfoService'这个服务类
<property name="teacherInfoService">
<ref local="teacherInfoService" />
'teacherInfoService'这个对象在action中是否存在并具有相应的setter方法
'teacherInfoService'这个在配置文件中是否存在
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/display' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'teacherInfoService' of bean class [com.teacherInfo.struts.action.DisplayAction]: No property 'teacherInfoService' found你所需要的东西,可以分开配一下,用import 或者是include等等,这样将文件分开,你也可以看得清楚,
其次,找问题,可以看问题提示,因为它至少是指向了一些问题的地方,当然不一定就是这里的问题,但是大部分是八九不离十了.
这里,还有就是,前后台所需要的东西就如楼上说的,需要get和set ,这个就看你需要了,取得或者是设置,多看看就清晰了,
因为开始只用一个action的时候可以执行 没有任何问题~