HelloWorld.java > MODEL

본문 바로가기

사이트 내 전체검색

뒤로가기 MODEL

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

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기