使用servlet和jsp在String []数组中获取数据

时间:2019-04-16 20:01:43

标签: 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);       

                    //here I am trying to get values

                    addEducation.getList();

                   educatiodetails educat =education.geteducatiodetails(SchoolName[i]);  

//here my session just get the first value 

session.setAttribute("educat",educat);
                       }
                      }

0 个答案:

没有答案