主要的相关的代码
-------------dao--------------------
public class StudentDaoImpl extends HibernateDaoSupport implements StudentDao {
public void addStudent(Student student) {
this.getHibernateTemplate().save(student);
}
}
--------------service----------------------
public class StudentServiceImpl implements StudentService {
private StudentDao studentDao;
public void addStudent(Student student) {
studentDao.addStudent(student);
}
public void setStudentDao(StudentDao studentDao) {
this.studentDao = studentDao;
}
}
--------------xml------------------------
<bean id="studentDao" class="org.ujs.ssh.dao.impl.StudentDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="studentService" class="org.ujs.ssh.service.impl.StudentServiceImpl">
<property name="studentDao" ref="studentDao"/>
</bean>
错误提示:
Invalid property 'studentService' of bean class [org.ujs.ssh.action.StudentActioin]: Bean property 'studentService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
拜托各位大大了,小生这厢有礼了
-------------dao--------------------
public class StudentDaoImpl extends HibernateDaoSupport implements StudentDao {
public void addStudent(Student student) {
this.getHibernateTemplate().save(student);
}
}
--------------service----------------------
public class StudentServiceImpl implements StudentService {
private StudentDao studentDao;
public void addStudent(Student student) {
studentDao.addStudent(student);
}
public void setStudentDao(StudentDao studentDao) {
this.studentDao = studentDao;
}
}
--------------xml------------------------
<bean id="studentDao" class="org.ujs.ssh.dao.impl.StudentDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="studentService" class="org.ujs.ssh.service.impl.StudentServiceImpl">
<property name="studentDao" ref="studentDao"/>
</bean>
错误提示:
Invalid property 'studentService' of bean class [org.ujs.ssh.action.StudentActioin]: Bean property 'studentService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
拜托各位大大了,小生这厢有礼了
检查其字段成员studentService类型是不是StudentService
和有正确的getStudentService方法和setStudentService方法,
及getStudentService的返回类型和setStudentService的参数类型。
<bean id="studentActioin" class="org.ujs.ssh.action.StudentActioin">
<property name="studentService" ref="studentService"/>
</bean>
正确与否