Servlet에서 POST시 한글 깨짐

박주현·2022년 12월 15일
0

혼공

목록 보기
11/20
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		MemberBean member = new MemberBean();
		request.setCharacterEncoding("UTF-8");
		member.setName(request.getParameter("name"));
		member.setId(request.getParameter("id"));
		member.setNickName(request.getParameter("nickName"));
		member.setPassword(request.getParameter("password"));
		member.setEmail(request.getParameter("email"));
		member.setPhoneNumber(request.getParameter("phoneNumber"));
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("09_el.jsp");
		request.setAttribute("member", member);
		dispatcher.forward(request, response);
	}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		MemberBean member = new MemberBean();
		
		member.setName(request.getParameter("name"));
		member.setId(request.getParameter("id"));
		member.setNickName(request.getParameter("nickName"));
		member.setPassword(request.getParameter("password"));
		member.setEmail(request.getParameter("email"));
		member.setPhoneNumber(request.getParameter("phoneNumber"));
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("09_el.jsp");
        request.setCharacterEncoding("UTF-8");
		request.setAttribute("member", member);
		dispatcher.forward(request, response);
	}

0개의 댓글