我试图动态获取我在数据库中插入的值,但无法获取该值。这是我的代码
String[] SchoolName = request.getParameterValues("shoolname");
String[] DateFrom = request.getParameterValues("Dateform");
String[] DateTo = request.getParameterValues("Datato");
String[] DiscriptDetails = request.getParameterValues("Dscript");
这用于插入数据,并且可以正常工作。
for ( int i = 0 ; i < SchoolName.length;++i ) {
educatiodetails edu = new educatiodetails();
edu.setSchoolName(SchoolName[i]);
edu.setDateFrom(DateFrom[i]);
edu.setDateTo(DateTo[i]);
edu.setDiscriptDetails(DiscriptDetails[i]);
EducatiIMP education = new EducatiIMP();
education.addEducation(edu);
HttpSession session = request.getSession(true);
///我在这里尝试获取值
addEducation.getList();
educatiodetails educat =education.geteducatiodetails(SchoolName[i]);
session.setAttribute("educat",educat);
}
}
这里是应该查看用户数据的我的jsp。
<% educatiodetails eduact = (educatiodetails) (session.getAttribute("educat"));%>
<% if (eduact != null ) { %>
<%= eduact.getSchoolName()%>
<%}%>