±Û¾´ÀÌ :±è¿ëÁø 1998³â 9¿ù 22ÀÏ 08:31:50
In Reply to: Servlet¿¡¼ ÇѱÛó¸® ¹× Cookie¼³Á¤ posted by ÀÌÁøÈ£ on 1998³â 9¿ù 18ÀÏ 14:30:13:
Çѱ۷ΠencodingÀ» ¹Ù²Ù±â Àü¿¡ Mime type ¼³Á¤½Ã ´ÙÀ½°ú °°ÀÌ Çϼ¼¿ä
res.setContentType("text/html; charset=euc-kr");
PrintStream out = new PrintStream(res.getOutputStream());
±×¸®°í Cookie ¼³Á¤ÀºÀ» Import ÇÑÈÄ
Cookie º¯¼ö ÁöÁ¤À» ÇÑ´ÙÀ½ ÄíÅ°°ªÀ» ¼³Á¤ÇÏ¸é µË´Ï´Ù.
import sun.servlet.http.Cookie;
.
..
Cookie c,c1;
c = new Cookie("userid","xxx");
c1= new Cookie("paswd","xxx");
c.setComment("cookie test");
c.saveCookie(res);
c1.saveCookie(res);
À§ÀÇ resº¯¼ö´Â HttpServletResponse parameterÀ롃 ¾Æ½ÃÁÒ
±×¸®°í ¿©±â °Ô½ÃÆÇ¿¡ °ü·ÃµÈ ³»¿ëµéÀÌ ¸¹ÀÌ ÀÖ½À´Ï´Ù.
Âü°íÇϼ¼¿ä