| [1eb7a55] | 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|---|
| 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
|---|
| 3 |
|
|---|
| 4 | <!DOCTYPE html>
|
|---|
| 5 | <html lang="en">
|
|---|
| 6 | <head>
|
|---|
| 7 | <title>${student != null ? "Edit Student" : "Add New Student"}</title>
|
|---|
| 8 | <link rel="stylesheet"
|
|---|
| 9 | href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
|---|
| 10 | </head>
|
|---|
| 11 | <body>
|
|---|
| 12 | <div class="container col-md-6 mt-5">
|
|---|
| 13 | <div class="card">
|
|---|
| 14 | <div class="card-body">
|
|---|
| 15 | <h2>${student != null ? "Edit Student" : "Add New Student"}</h2>
|
|---|
| 16 | <form action="${pageContext.request.contextPath}/student/${student != null ? 'update' : 'insert'}" method="post">
|
|---|
| 17 |
|
|---|
| 18 | <c:if test="${student != null}">
|
|---|
| 19 | <input type="hidden" name="id" value="${student.id}" />
|
|---|
| 20 | </c:if>
|
|---|
| 21 |
|
|---|
| 22 | <div class="form-group">
|
|---|
| 23 | <label for="name">Name *</label>
|
|---|
| 24 | <input type="text" id="name" name="name" class="form-control"
|
|---|
| 25 | value="${student != null ? student.name : ''}" required>
|
|---|
| 26 | </div>
|
|---|
| 27 |
|
|---|
| 28 | <div class="form-group">
|
|---|
| 29 | <label for="surname">Surname *</label>
|
|---|
| 30 | <input type="text" id="surname" name="surname" class="form-control"
|
|---|
| 31 | value="${student != null ? student.surname : ''}" required>
|
|---|
| 32 | </div>
|
|---|
| 33 |
|
|---|
| 34 | <div class="form-group">
|
|---|
| 35 | <label for="location">Location</label>
|
|---|
| 36 | <input type="text" id="location" name="location" class="form-control"
|
|---|
| 37 | value="${student != null ? student.location : ''}">
|
|---|
| 38 | </div>
|
|---|
| 39 |
|
|---|
| 40 | <div class="form-group">
|
|---|
| 41 | <label for="studentindex">Index Number *</label>
|
|---|
| 42 | <input type="number" id="studentindex" name="studentindex" class="form-control"
|
|---|
| 43 | value="${student != null ? student.studentindex : ''}" required>
|
|---|
| 44 | </div>
|
|---|
| 45 |
|
|---|
| 46 | <div class="form-group">
|
|---|
| 47 | <label for="facultyid">Faculty *</label>
|
|---|
| 48 | <select id="facultyid" name="facultyid" class="form-control" required>
|
|---|
| 49 | <option value="">-- Select Faculty --</option>
|
|---|
| 50 | <c:forEach var="faculty" items="${faculties}">
|
|---|
| 51 | <option value="${faculty.id}"
|
|---|
| 52 | <c:if test="${student != null && student.facultyid == faculty.id}">selected</c:if>>
|
|---|
| 53 | ${faculty.name}
|
|---|
| 54 | </option>
|
|---|
| 55 | </c:forEach>
|
|---|
| 56 | </select>
|
|---|
| 57 | </div>
|
|---|
| 58 |
|
|---|
| 59 | <div class="mt-4">
|
|---|
| 60 | <button type="submit" class="btn btn-primary">${student != null ? "Update" : "Save"}</button>
|
|---|
| 61 | <a href="${pageContext.request.contextPath}/student/list" class="btn btn-secondary">Cancel</a>
|
|---|
| 62 | </div>
|
|---|
| 63 | </form>
|
|---|
| 64 | </div>
|
|---|
| 65 | </div>
|
|---|
| 66 | </div>
|
|---|
| 67 | </body>
|
|---|
| 68 | </html> |
|---|