-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.sai.servlet; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpSession; | ||
|
||
import com.sai.dao.MemberDAO; | ||
import com.sai.vo.MemberVO; | ||
|
||
public class LoginMember implements Action { | ||
|
||
public String execute(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
response.setContentType("text/html;charset=UTF-8"); | ||
|
||
String memberId = request.getParameter("memberId"); | ||
String memberPw = request.getParameter("memberPw"); | ||
|
||
System.out.println("로그인이 요청된 아이디: " + memberId); | ||
System.out.println("로그인이 요청된 패스워드: " + memberPw); | ||
|
||
MemberVO vo = new MemberDAO().login(memberId, memberPw); | ||
|
||
if(vo.getMEMBER_ID() != null) { | ||
session = request.getSession(); | ||
session.setAttribute("sessId", vo.getMEMBER_ID()); | ||
System.out.println("vo에 저장된 아이디: " + vo.getMEMBER_ID()); | ||
System.out.println(session.getAttribute("sessId")); | ||
|
||
session.setAttribute("sessPw", vo.getMEMBER_PW()); | ||
session.setAttribute("sessName", vo.getMEMBER_NAME()); | ||
session.setAttribute("sessStation", vo.getMEMBER_STATION()); | ||
session.setAttribute("sessPhone", vo.getMEMBER_PHONE()); | ||
|
||
System.out.println("로그인 페이지에서 세션 설정 값: " + session.getAttribute("sessId")); | ||
|
||
return "mainPage.html"; | ||
} | ||
|
||
response.setContentType("text/html;charset=UTF-8"); | ||
return "index.html"; | ||
} | ||
|
||
} |