package명 : step01.view, Servlet 클래스명 : SuccessView 파일 생성
package step01.view;
import java.io.IOException;
import java.io.PrintWriter;
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("/success")
public class SuccessView extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request,response);
}
protected void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// client 브라우저에 안녕하세요 출력
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("안녕하세요");
}
}
login.html에서 id : tester로 입력하면 (tester제외 다른 id는 fail)
안녕하세요 출력