Created
August 27, 2019 02:13
-
-
Save darbyluv2code/47c913e1f9dcf959662e1f00f479b49e to your computer and use it in GitHub Desktop.
list_students.jsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="com.dj.bean.Student"%> | |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" | |
pageEncoding="ISO-8859-1"%> | |
<%@ page import="java.util.*,com.dj.*"%> | |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="ISO-8859-1"> | |
<link type="text/css" rel="stylesheet" href="css/style.css"> | |
<title>Students Tracker App</title> | |
</head> | |
<% | |
List<Student> studentList = (List<Student>) request.getAttribute("STUDENT_LIST"); | |
%> | |
<body> | |
<div id="wrapper"> | |
<div id="header"> | |
<h2>My University</h2> | |
</div> | |
</div> | |
<div id="container"> | |
<div id="content"> | |
<input type="button" value="Add Student" onclick="window.location.href='add-student-form.jsp'; return false;" class="add-student-button"/> | |
<table> | |
<tr> | |
<th>First Name</th> | |
<th>Last Name</th> | |
<th>Email</th> | |
<th>Action</th> | |
</tr> | |
<% for(Student student : studentList) { %> | |
<c:url var="deleteLink" value="StudentControllerServlet"> | |
<c:param name="command" value="DELETE"></c:param> | |
<c:param name="studentId" value="<%= Integer.toString(student.getId()) %>"></c:param> | |
</c:url> | |
<c:url var="updateLink" value="StudentControllerServlet"> | |
<c:param name="command" value="LOAD"></c:param> | |
<c:param name="studentId" value="<%= Integer.toString(student.getId()) %>"></c:param> | |
</c:url> | |
<tr> | |
<td><%=student.getFirstName() %></td> | |
<td><%=student.getLastName() %></td> | |
<td><%=student.getEmail() %></td> | |
<td><a href="${updateLink}">Update</a> | <a href="${deleteLink}" onclick="if (!(confirm('Are you sure you want to delete this student?'))) return false">Delete</a></td> | |
</tr> | |
<%}%> | |
</table> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment