HelloWorld.java
페이지 정보
작성자 관리자 작성일 21-07-15 20:10 조회 544 댓글 0본문
package controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
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("/HelloWorld")
public class HelloWorld extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
reqPro(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
reqPro(request, response);
}
protected void reqPro(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String str = "Hello World ~ 안녕하세요~";
request.setAttribute("str", str);
RequestDispatcher rdis = request.getRequestDispatcher("hello_world.jsp");
rdis.forward(request, response);
}
}
댓글목록 0
등록된 댓글이 없습니다.