我正在尝试获取动态插入数据库中的值,但无法获取该值

时间:2019-04-23 21:31:08

标签: jsp servlets

我试图动态获取我在数据库中插入的值,但无法获取该值。这是我的代码

     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()%>

<%}%>

0 个答案:

没有答案