login.html
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h1>로그인 페이지</h1>
<form action="login-page" method="get">
ID : <input type="text" name="id"><br>
PW : <input type="password" name="pw"><br>
<input type="submit" value="로그인">
</form>
</body>
</html>
LoginPage.java
package login;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/login-page")
public class LoginPage extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("login-page 접속");
String id = request.getParameter("id"); //get 방식으로 id 받아오기
String pw = request.getParameter("pw"); //get 방식으로 pw 받아오기
System.out.println(id);
System.out.println(pw);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}