<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.heeeun.member.MemberEntity" %>
<jsp:useBean id="memdb" class="com.heeeun.member.DBconnection" scope="page"/>    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
 String userID = request.getParameter("userID");
 String userPW = request.getParameter("userPW");
 
 String id=null;
 String passwd=null;
 String name=null;
 
 ArrayList<MemberEntity> list = memdb.getMemberList();
 
 int counter=list.size();
 
 for(MemberEntity memEnt : list){
	 if(memEnt.getId().equals(userID) ){
		 id=memEnt.getId();
		 passwd=memEnt.getPasswd();
		 name=memEnt.getName();
	 }
 }

 if (userID.equals(id) && userPW.equals(passwd)){
	 session.setAttribute("id",id);
	 session.setAttribute("name", name);
	 
	 %>
	 <script>
	 alert("로그인에 성공하였습니다.");
	 location.href("dataInput.jsp");
	 </script>
	 <%
 }
 else { %>
 <script>
 alert("로그인 실패하셨습니다.");
 history.go(-1); 
 </script>
 <%} 
 %>
 
 
 
 
 
 
 
	 
 }





%>




</body>
</html>