我用的SSM框架 这是java类
@Controller
@RequestMapping("/studentController")
public class StudentController {
@Autowired
private StudentServices studentServices;
public StudentServices getStudentServices() {
return studentServices;
}
public void setStudentServices(StudentServices studentServices) {
this.studentServices = studentServices;
}
@RequestMapping("showStudent")
public String showStudents(Model model,HttpServletRequest request){
String currentPage = request.getParameter("currentPage")==null?"0": request.getParameter("currentPage");
long studentCount = studentServices.getStudentCount();
int pageSum = (int) (studentCount%20 == 0?studentCount/20:studentCount/20+1);
if(Integer.parseInt(currentPage)>=0&&Integer.parseInt(currentPage)
model.addAttribute("students", students);
request.setAttribute("studentCount", studentCount);
request.setAttribute("currentPage", currentPage);
request.setAttribute("pageSum", pageSum);
return "showInfos/showStudent";
}else{
return "errorPage/showError";
}
}
}
这是JSP
学生编号
学生姓名
学生性别
学生年龄
学生地址
学生生日
删除学生
修改学生
${stu.stuid }
${stu.name }
${stu.sex }
${stu.age }
${stu.address }
${bir }
删除学生
修改学生
这是完成JSP展示数据库的数据,其他的类我就不写了。希望能帮到你