studentBar.jsp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. $.getJSON('${loadStudentsByGroup}', {
  27. groupId : $(this).value(),
  28. ajax : 'true'
  29. }, function(data) {
  30. var html = '<option value="">Первый элемент</option>';
  31. $('#studentId').html(html);
  32. });
  33. });
  34. });
  35. </script>
  36. <body>
  37. <form:form method="post" modelAttribute="studentLogin" action="checkStudent">
  38. <form:select id="groupId" path="">
  39. <c:forEach items="${groupList}" var="group">
  40. <form:option value="${group.groupId}" >${group.groupName}</form:option>
  41. </c:forEach><br/>
  42. </form:select>
  43. <form:select id="studentId" path="name">
  44. </form:select>
  45. </form:form>
  46. </body>
  47. </html>