JSP/SEARCH
allList
GAWON
2023. 6. 12. 17:09
<%@page import="org.joonzis.dao.EmployeeDaoImpl"%>
<%@page import="org.joonzis.vo.EmployeeVO"%>
<%@page import="org.joonzis.dao.EmployeeDao"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
List<EmployeeVO> list = EmployeeDaoImpl.GetInstance().getALLEmployees();
pageContext.setAttribute("list", list);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
div{
width: 800px;
text-align: center;
margin: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th,td{
border: 1px solid gray;
}
th{
padding: 5px;
background-color: blue;
color: white;
}
</style>
</head>
<body>
<div>
<h1>전체 직원 목록</h1>
<table>
<thead>
<tr>
<th>직원</th>
<th>이름</th>
<th>연락처</th>
<th>연봉</th>
<th>부서ID</th>
<th>고용일</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test="${not empty list }">
<c:forEach var ="vo" items="${list }">
<tr>
<td>${vo.employee_id }</td>
<td>${vo.first_name }${vo.last_name}</td>
<td>${vo.phone_number }</td>
<td>${vo.salary }</td>
<td>${vo.department_id }</td>
<td>${vo.hire_date }</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="6">전체 목록보기</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
</div>
</body>
</html>