------解决方法--------------------------------------------------------'Error testing property name in bean of type null'不知道问题出在哪里
Student类:
private Integer id;
private String name;
private String password;
public Student() {
}
public Student(String name, String password) {
this.name = name;
this.password = password;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
-------------------------------
StudentOp 类:
private StudentDAOBase studentDAO = new StudentDAOBase();
private Student student = new Student();
private DataModel allStudents = new ListDataModel();
public DataModel getAllStudents() {
return allStudents;
}
public void setAllStudents(DataModel allStudents) {
this.allStudents = allStudents;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public StudentDAOBase getStudentDAO() {
return studentDAO;
}
public void setStudentDAO(StudentDAOBase studentDAO) {
this.studentDAO = studentDAO;
}
public String add() {
//studentDAO.add(this.getStudent());
return "addSuccess ";
}
---------------------------------
faces-config.xml
<faces-config >
<managed-bean>
<managed-bean-name> studentOp </managed-bean-name>
<managed-bean-class> com.jsf.bean.StudentOp </managed-bean-class>
<managed-bean-scope> session </managed-bean-scope>
<managed-property>
<property-name> allStudents </property-name>
<property-class> javax.faces.model.DataModel </property-class>
<null-value> </null-value>
</managed-property>
<managed-property>
<property-name> student </property-name>
<property-class>
com.jsf.hibernate.DAO.Student
</property-class>
<null-value> </null-value>
</managed-property>
<managed-property>
<property-name> studentDAO </property-name>
<property-class>
com.jsf.hibernate.DAO.StudentDAOBase