{"id":340,"date":"2012-10-09T11:07:53","date_gmt":"2012-10-09T02:07:53","guid":{"rendered":"http:\/\/www.freesens.com\/x\/?p=340"},"modified":"2013-02-02T11:33:55","modified_gmt":"2013-02-02T02:33:55","slug":"httpservletresponse-%ea%b0%9d%ec%b2%b4%ec%97%90%ec%84%9c-printwriter-%ea%b0%9d%ec%b2%b4%eb%a5%bc-%ec%96%bb%ec%96%b4%ec%84%9c-%ec%a7%81%ec%a0%91-%ec%b6%9c%eb%a0%a5%ec%8b%9c-contenttype-%ec%b2%98","status":"publish","type":"post","link":"http:\/\/www.freesens.com\/x\/?p=340","title":{"rendered":"HttpServletResponse \uac1d\uccb4\uc5d0\uc11c PrintWriter \uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c, \uc9c1\uc811 \ucd9c\ub825\uc2dc contentType \ucc98\ub9ac."},"content":{"rendered":"<p>\ub2e4\uc74c\uacfc \uac19\uc774 HttpServletResponse \uac1d\uccb4\uc5d0\uc11c PrintWriter\uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c, \uc9c1\uc811 \ud14d\uc2a4\ud2b8\ub97c \ucd9c\ub825\ud560 \uacbd\uc6b0 \uc758\ub3c4\uc640 \ub2ec\ub9ac \ube0c\ub77c\uc6b0\uc800 \ub808\ubca8\uc5d0\uc11c\ub294 \ud574\ub2f9 \ucee8\ud150\uce20\ub97c \uc77c\ubc18 \ud14d\uc2a4\ud2b8\ub85c \uc778\uc2dd\ud558\uc5ec, html\ud30c\uc2f1\uc744 \uc218\ud589\ud558\uc9c0 \uc54a\uace0, \ucf54\ub4dc\ub97c \uadf8\ub300\ub85c \ud654\uba74\uc5d0 \ucd9c\ub825\ud558\ub294 \ud604\uc0c1\uc774 \ubc1c\uc0dd\ud558\ub294 \uacbd\uc6b0\uac00 \uc788\ub2e4.<br \/>\n(\uc0ac\uc2e4 \ud604\uc7ac \ud22c\uc785\ub41c \ud504\ub85c\uc81d\ud2b8\uc758 \uc18c\uc2a4\ub97c \ubd84\uc11d\ud558\ub2e4 \ubcf4\ub2c8 \uadf8\ub807\uac8c \ub418\uc5b4 \uc788\ub354\ub77c\ub294&#8230;&#8230;. \u00a0\uc6b4\uc601\uae30\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 WAS\uc5d0\uc11c\ub294 \uce5c\uc808\ud558\uac8c \uc54c\uc544\uc11c \ud5e4\ub354\ub97c \uc138\ud305\ud574\uc8fc\ub294\uc9c0 \ubb38\uc81c\uac00 \uc5c6\ub294\ub4ef \ud558\ub098, \uac1c\ubc1c\ud658\uacbd\uc758 WAS\ub294 \uc880 \ub354 \uc5c4\uaca9\ud788 \ucc98\ub9ac\ub418\ub294 \ub2e4\ub978 \uc81c\ud488\uc744 \uc0ac\uc6a9\ud558\ub2e4 \ubcf4\ub2c8 \uc544\ub798\uc758 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud574\uc11c&#8230;..\ud574\uacb0\ucc45\uc744 \ucc3e\uc544\ubd04&#8230;&#8230;&#8230;.. \u00a0)<\/p>\n<div style=\"border-top: 1px dashed #cccccc; border-bottom: 1px dashed #cccccc; background: #f7f7f7; padding: 10px;\">\n<pre>public ModelAndView testWrite(HttpServletRequest request, HttpServletResponse response) throws Exception {\r\n    PrintWriter out = response.getWriter();\r\n    out.println(\"&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;TEST&lt;\/TITLE&gt;\");\r\n    out.println(\"&lt;SCRIPT LANGUAGE=\\\"JAVASCRIPT\\\"&gt;\");\r\n    out.println(\" function fnForward() {\");\r\n    out.println(\" document.family.submit(); \");\r\n    out.println(\" }\");\r\n    out.println(\"&lt;\/script&gt;&lt;\/head&gt;\");\r\n    out.println(\"&lt;body onload=\\\"fnForward();\\\"&gt;\");\r\n    out.println(\" &lt;form name=\\\"family\\\" action=\\\"http:\/\/xxx.com\\\" method=\\\"post\\\"&gt;\");\r\n    out.println(\" &lt;input name=\\\"login_id\\\" type=\\\"hidden\\\" value=\\\"test\\\"&gt;\");\r\n    out.println(\" &lt;input name=\\\"password\\\" type=\\\"hidden\\\" value=\\\"test\\\"&gt;\");\r\n    out.println(\" &lt;\/form&gt;\");\r\n    out.println(\"&lt;\/body&gt;\");\r\n    out.println(\"&lt;\/HTML&gt;\");\r\n}<\/pre>\n<\/div>\n<p>JSP\ud398\uc774\uc9c0\ub77c\uba74 &lt;@page contentType=&#8221;text\/html;&#8221;&gt; \ud615\ud0dc\ub85c \ud398\uc774\uc9c0 \uc0c1\ub2e8\uc5d0 \ud574\ub2f9 \ud398\uc774\uc9c0\uac00 html\ucee8\ud150\uce20\ub77c\ub294 \uc815\ubcf4\ub97c \uba85\uc2dc\ud558\uace0 \uc788\uae30 \ub54c\ubb38\uc5d0, WAS\uc5d0\uc11c JSP\ud398\uc774\uc9c0\ub97c \uc2e4\ud589\ud55c \uacb0\uacfc\ub97c \ubc18\ud658\ud560\ub54c html\ucee8\ud150\uce20\ub77c\ub294 \uc815\ubcf4\ub97c \ud5e4\ub354\uc5d0 \ud3ec\ud568\ud574\uc11c \uc804\ub2ec\ud558\uace0, \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c \uc815\uc0c1\uc801\uc73c\ub85c \ud30c\uc2f1\ud558\uc5ec \ud45c\uc2dc\uac00 \ub418\uc9c0\ub9cc, Controller\ub808\ubca8\uc5d0\uc11c \uc704\uc758 \ucf54\ub4dc\uc640 \uac19\uc774 \uc784\uc758\ub85c PrintWriter\uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c \ucd9c\ub825\ud558\ub294 \uacbd\uc6b0\uc5d0\ub294 \ud5e4\ub354\uc5d0 \ucee8\ud150\uce20 \uc885\ub958\uac00 \uc5b4\ub5a4 \uac83\uc778\uc9c0 \uba85\uc2dc\ub418\uc9c0 \uc54a\uc544\uc11c, \ube0c\ub77c\uc6b0\uc800\uac00 \uc77c\ubc18\ud14d\uc2a4\ud2b8\ub85c \uc778\uc2dd\ud558\uc5ec \uc2e4\ud589\uc774 \uc548\ub418\ub294 \uacbd\uc6b0\uac00 \ubc1c\uc0dd\ud55c\ub2e4.<\/p>\n<p>\uc704\uc758 \ud604\uc0c1\uc744 \ud574\uacb0\ud558\uae30 \uc704\ud574\uc11c HttpServletResponse \uac1d\uccb4\uc5d0 setHeader() \uba54\uc18c\ub4dc\ub97c \uc774\uc6a9\ud558\uc5ec \uac15\uc81c\ub85c \uc544\ub798\uc640 \uac19\uc774 contentType\uc744 \uc9c0\uc815\ud574 \ubd24\uc73c\ub098&#8230;&#8230;\uc548\ub418\ub294;;;;;<\/p>\n<div style=\"border-top: 1px dashed #cccccc; border-bottom: 1px dashed #cccccc; background: #f7f7f7; padding: 10px;\">\n<pre>response.setHeader(\"contentType\", \"text\/html\");<\/pre>\n<\/div>\n<p>\uac80\uc0c9\uc744 \uc870\uae08 \ub354 \ud574\ubcf4\ub2c8&#8230;&#8230;response\uac1d\uccb4\uc5d0\ub294 setHeader\ub9d0\uace0&#8230;&#8230;.\uc544\ub798\uc640 \uac19\uc740 \ub140\uc11d\uc774 \uc788\ub354\ub77c\ub294&#8230;&#8230;<\/p>\n<div style=\"border-top: 1px dashed #cccccc; border-bottom: 1px dashed #cccccc; background: #f7f7f7; padding: 10px;\">\n<pre>response.setContentType(\"text\/html\");<\/pre>\n<\/div>\n<p>\uc704\uc640\uac19\uc740 \ubc29\ubc95\uc73c\ub85c response \uac1d\uccb4\uc5d0 \ucee8\ud150\uce20 \uc720\ud615\uc744 \uac15\uc81c\ub85c \ud560\ub2f9\ud558\uace0, PrintWriter \uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c \ucd9c\ub825\ud560 \uacbd\uc6b0 \uc784\uc758\ub85c \uc9c0\uc815\ud55c \ucee8\ud150\uce20\ub85c \uc778\uc2dd\uc2dc\ud0ac \uc218 \uc788\ub2e4.<br \/>\nresponse \uac1d\uccb4\uc5d0\ub294 setContentType() \uc774\uc678\uc5d0 setCharacterEncoding() \uc774\ub098 setLocale() \ub4f1\ub3c4 \uc788\uc73c\ub2c8&#8230; setHeader()\ub97c \uc774\uc6a9\ud558\uae30 \uc804\uc5d0 \uc774\ubbf8 \uc815\uc758\ub41c \ud5e4\ub354\uac12\ub4e4\uc744 \ucc98\ub9ac\ud558\ub294 \ub140\uc11d\uc774 \uc788\ub294\uc9c0\ub294 \ud55c\ubc88\ucbe4 \ubd10\uc57c\ud560\ub4ef&#8230;&#8230;&#8230;(\uadf8\ub7f0\uac8c \uba87\uac1c \uc548\ub428;;;)<\/p>\n<p>\uadfc\ub370 Controller \ub808\ubca8\uc5d0\uc11c \uc9c1\uc811 PrintWriter\uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c \ucd9c\ub825\ud558\ub294\uac74&#8230;&#8230;.\uc62c\ubc14\ub978 \ubc29\ubc95\uc740 \uc544\ub2cc\ub4ef&#8230;&#8230;JSP\ud398\uc774\uc9c0 \ud558\ub098 \ub354 \ub9cc\ub4dc\ub294\uac8c \uadf8\ub807\uac8c \uadc0\ucc2e\uc558\ub098&#8230;.;;;;;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub2e4\uc74c\uacfc \uac19\uc774 HttpServletResponse \uac1d\uccb4\uc5d0\uc11c PrintWriter\uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c, \uc9c1\uc811 \ud14d\uc2a4\ud2b8\ub97c \ucd9c\ub825\ud560 \uacbd\uc6b0 \uc758\ub3c4\uc640 \ub2ec\ub9ac \ube0c\ub77c\uc6b0\uc800 \ub808\ubca8\uc5d0\uc11c\ub294 \ud574\ub2f9 \ucee8\ud150\uce20\ub97c \uc77c\ubc18 \ud14d\uc2a4\ud2b8\ub85c \uc778\uc2dd\ud558\uc5ec, html\ud30c\uc2f1\uc744 \uc218\ud589\ud558\uc9c0 \uc54a\uace0, \ucf54\ub4dc\ub97c \uadf8\ub300\ub85c \ud654\uba74\uc5d0 \ucd9c\ub825\ud558\ub294 \ud604\uc0c1\uc774 \ubc1c\uc0dd\ud558\ub294 \uacbd\uc6b0\uac00 \uc788\ub2e4. (\uc0ac\uc2e4 \ud604\uc7ac \ud22c\uc785\ub41c \ud504\ub85c\uc81d\ud2b8\uc758 \uc18c\uc2a4\ub97c \ubd84\uc11d\ud558\ub2e4 \ubcf4\ub2c8 \uadf8\ub807\uac8c \ub418\uc5b4 \uc788\ub354\ub77c\ub294&#8230;&#8230;. \u00a0\uc6b4\uc601\uae30\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 WAS\uc5d0\uc11c\ub294 \uce5c\uc808\ud558\uac8c \uc54c\uc544\uc11c \ud5e4\ub354\ub97c \uc138\ud305\ud574\uc8fc\ub294\uc9c0 \ubb38\uc81c\uac00 \uc5c6\ub294\ub4ef \ud558\ub098, \uac1c\ubc1c\ud658\uacbd\uc758 WAS\ub294 \uc880 \ub354 \uc5c4\uaca9\ud788 &hellip; <a href=\"http:\/\/www.freesens.com\/x\/?p=340\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HttpServletResponse \uac1d\uccb4\uc5d0\uc11c PrintWriter \uac1d\uccb4\ub97c \uc5bb\uc5b4\uc11c, \uc9c1\uc811 \ucd9c\ub825\uc2dc contentType \ucc98\ub9ac.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[71,72],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-java","tag-java-2","tag-servlet"],"_links":{"self":[{"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=340"}],"version-history":[{"count":6,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":483,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions\/483"}],"wp:attachment":[{"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.freesens.com\/x\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}