JSP Servlet : out객체 한글응답

스프링 프레임웍에서 뷰를 선택안하고 MVC흐름을 벗어나 데이터를 받고 비지니스 로직에 따라 처리후
에러지 간단히 Alert메세지를 주는작업중이였다. RC4암호화 페이지작업도중 한글이 깨져전송되고있었다.
뭐지?! 했는데 response.setContentType위치가 out객체보다 밑에 있었다 ㅎ

@RequestMapping(value="/app/test.do")
public void renderMergedOutputModel(Map model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType("text/html; charset=utf-8");
PrintWriter out = response.getWriter();
out.write("한글");
out.flush();
}

Leave a Reply

Your email address will not be published.