studentBar.jsp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <%--suppress JSUnresolvedFunction --%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
  4. <%--suppress ALL --%>
  5. <%--
  6. Created by IntelliJ IDEA.
  7. User: Кинетик
  8. Date: 28.12.2016
  9. Time: 20:07
  10. To change this template use File | Settings | File Templates.
  11. --%>
  12. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  13. <!DOCTYPE html>
  14. <html>
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  17. <title>JSP Page</title>
  18. <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  19. <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  20. </head>
  21. <c:url var="loadStudentsByGroup" value="/loadStudents" />
  22. <script type="text/javascript">
  23. $(document).ready(function() {
  24. $('#groupId').change(
  25. function() {
  26. $.get('${loadStudentsByGroup}', {
  27. groupId : $(this).val(),
  28. ajax : 'true'
  29. }, function(data) {
  30. var html = '<option value="">Первый элемент</option>';
  31. var len = data.length;
  32. for ( var i = 0; i < len; i++) {
  33. html += '<option value="' + data[i].studentsId + '">'
  34. + data[i].stFamily + '</option>';
  35. }
  36. html += '</option>';
  37. $('#studentId').html(html);
  38. });
  39. });
  40. });
  41. </script>
  42. <body>
  43. <form:form method="post" modelAttribute="studentLogin" action="checkStudent">
  44. <form:select id="groupId" path="">
  45. <c:forEach items="${groupList}" var="group">
  46. <form:option value="${group.groupId}" >${group.groupName}</form:option>
  47. </c:forEach><br/>
  48. </form:select>
  49. <form:select id="studentId" path="name">
  50. </form:select>
  51. </form:form>
  52. </body>
  53. </html>