Skip to content

Instantly share code, notes, and snippets.

@darbyluv2code
Created August 13, 2019 00:37
Show Gist options
  • Save darbyluv2code/cb002390875d63c12bba9100dbc0cfee to your computer and use it in GitHub Desktop.
Save darbyluv2code/cb002390875d63c12bba9100dbc0cfee to your computer and use it in GitHub Desktop.
list students with scriptlets
<%@ page import="java.util.*, com.luv2code.web.jdbc.*" %>
<!DOCTYPE html>
<html>
<head>
<title>Student Tracker App</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
</head>
<%
// get the students from the request object (sent by servlet)
List<Student> theStudents =
(List<Student>) request.getAttribute("STUDENT_LIST");
%>
<body>
<div id="wrapper">
<div id="header">
<h2>FooBar University</h2>
</div>
</div>
<div id="container">
<div id="content">
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
<% for (Student tempStudent : theStudents) { %>
<tr>
<td> <%= tempStudent.getFirstName() %> </td>
<td> <%= tempStudent.getLastName() %> </td>
<td> <%= tempStudent.getEmail() %> </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