我是新的支柱,我有使用採用彈簧與DAO實體類型POJO類支柱和後端一個前端,我想回到學生system.code我已經嘗試的名單附下面我得到值只有當我設置列表形式類。支柱2列表iterration
public class Studentform {
private StudentEntity student;
public StudentEntity getStudent() {
return student;
}
public void setStudent(StudentEntity student) {
this.student = student;
}
public void setStudent(ArrayList<StudentEntity> studentList) {
// TODO Auto-generated method stub
this.studentList=studentList;
}
}
action class code to acessslist is as studform.setStudent(studentList);
public class StudentAction extends ActionSupport implements
ModelDriven<Studentform> {
ArrayList<StudentEntity> studentList=new ArrayList<StudentEntity>();
//geters and setter for studentList
public String stdus() {
HttpSession session = ServletActionContext.getRequest().getSession();
String id = (String) session.getAttribute("userid");
studentList=controller.getStudentProfile();
studform.setStudentList(studentList);
System.out.println(studentList.size());
return "SUCCESS";
}
}
我想知道爲什麼我不能遍歷列表,如果我沒有在setstudent(名單)設置 – storm
所以,你想知道是什麼原因,如果你不設置您的列表,你不能重複你的名單?笑 – Boldbayar
是的,我需要一個答案 – storm