<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.heeeun.member.LectureEntity" %>
<%@ page import="java.util.ArrayList" %>
<% request.setCharacterEncoding("UTF-8"); %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>과목별 수강신청 리스트</title>
</head>
<body>
<center>
<jsp:useBean id="lecdb" class="com.heeeun.member.DBconnection" scope="page"/>



<%
/* 로그인 상태 확인하기*/
String loginId =(String) session.getAttribute("id");
String loginName = (String) session.getAttribute("name");
boolean login = (loginId == null) ? false : true;

if(login)
{
	out.println(loginName + "님 로그인하셨습니다.");
	out.println("<a href='logout.jsp'>로그아웃하겠습니다</a>");
}

else{
	out.println("로그인되어 있지 않습니다.");
	out.println("<a href='loginform.jsp'>로그인하기</a>");
}

%>

<h1>2018년 2학기 과목별 수강신청 현황</h1>
<form name="dataoutput">
<table align="center" border="1">
<tr>
<td>과목명</td>
<td>수강신청인원</td>
</tr>
<%
ArrayList<LectureEntity> list = lecdb.getEnrolLecture();

int counter = list.size();
if(counter>0)
{
	for(LectureEntity lecEnt : list){
		out.print("<tr>");
		out.print("<td width='100'>" + lecEnt.getLecName() +"</td>");
		out.print("<td width='100'>" + lecEnt.getCount() +"</td>");
		out.print("</tr>");
	}
	
}

%>
</table>
</form>
<a href="dataInput.jsp">수강신청하러가기</a>
</center>
</body>
</html>