MemRegServlet.java
페이지 정보
작성자 관리자 작성일 21-07-15 18:34 조회 347 댓글 0본문
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("/memReg")
public class MemRegServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public MemRegServlet() {
super();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 캐릭터셋 인코딩을 추가 해 줘야 한다. (한글깨짐 방지)
request.setCharacterEncoding("utf-8");
String name = request.getParameter("name");
String addr = request.getParameter("addr");
String tel = request.getParameter("tel");
String hobby = request.getParameter("hobby");
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println("이름 = "+name + "<br>");
out.println("주소 = "+addr + "<br>");
out.println("연락처 = "+tel + "<br>");
out.println("취미 = "+hobby + "<br>");
}
}
댓글목록 0
등록된 댓글이 없습니다.