HelloWorld.java
페이지 정보
본문
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);
}
}
- 이전글● HelloWorld servlet 만들기 21.07.15
- 다음글HelloWorld.jsp 21.07.15
댓글목록
등록된 댓글이 없습니다.