Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $
  2. .ajax({
  3. type: 'GET',
  4. url : "attendancePercentage",
  5. dataType: "json",
  6. data : {"stdate": stdate, "endate": endate},
  7. success : function(data, status) {
  8. alert(status);
  9. alert(data);
  10. }
  11. });
  12.  
  13. List<StudentMark> stList = new ArrayList<StudentMark>();
  14.  
  15. try {
  16. Class.forName("com.mysql.jdbc.Driver");
  17. Connection con = DriverManager.getConnection(
  18. "jdbc:mysql://localhost:3306/test_schema", "root", "root");
  19. String sql = "select * from attendance where attendance.date>=? and attendance.date<=?";
  20.  
  21. PreparedStatement pstmt = con.prepareStatement(sql);
  22. pstmt.setString(1, stDate);
  23. pstmt.setString(2, enDate);
  24.  
  25. rs = pstmt.executeQuery();
  26. while (rs.next()) {
  27. StudentMark ge = new StudentMark();
  28.  
  29. ge.setStudentName(rs.getString(3));
  30. ge.setDate(rs.getString(2));
  31. ge.setStatus(rs.getString(4));
  32. //System.out.println(("&&&&&..." + ge));
  33.  
  34. stList.add(ge);
  35. //System.out.println("ge :" + ge.getStudentName()+","+ge.getDate()+","+ge.getStatus());
  36.  
  37. }
  38.  
  39. System.out.println("list>>"+stList);
  40. System.out.println("list>>"+json);//[{"","",""}]
  41.  
  42. } catch (Exception e) {
  43. System.err.println(e.getMessage());
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement