๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ“ ๋ฐฐ์šฐ๊ณ  ์ตํžˆ๊ธฐ +/Web

(79)[Web]15์ผ์ฐจ: ((JSP))โ–  ์ฟ ํ‚ค(Cookie)์™€ ์„ธ์…˜ โ– , F_WebApp13, F_WebApp14, F_WebApp15, โ–  Emmet(์—๋ฐ‹) โ– , F_EmmetApp

by ์ข…์ด๋นจ๋Œ€ 2023. 12. 15.
TOP

๋ชฉ์ฐจ

    1. 2023.12.15(๊ธˆ)

    โ–  ์ฟ ํ‚ค(Cookie)์™€ ์„ธ์…˜ โ– 

     

    โ—‹ ์ฟ ํ‚ค(Cookie)

        - ์ฟ ํ‚ค๋Š” ํด๋ผ์ด์–ธํŠธ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ํด๋ผ์ด์–ธํŠธ์˜ ํ•˜๋“œ๋””์Šคํฌ์— ์ž‘์€ ํŒŒ์ผ ํ˜•ํƒœ๋กœ ์ €์žฅํ•œ ๊ฒƒ์œผ๋กœ ์„œ๋ฒ„์—์„œ ์‚ฌ์šฉ์ž์—๊ฒŒ ํŽธ๋ฆฌํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ๋งŽ์ด ์‚ฌ์šฉ๋˜๊ณ , ์ด ์ฟ ํ‚ค๋Š” ์›น ๋ธŒ๋ผ์šฐ์ €์— ์˜ํ•ด ๊ด€๋ฆฌ๋œ๋‹ค.

     

        - ์ฟ ํ‚ค๋Š” ํ…์ŠคํŠธ ํ˜•ํƒœ๋กœ ์ €์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณ€์กฐ๋‚˜ ๋ณต์‚ฌ๋“ฑ์ด ๊ฐ€๋Šฅํ•˜์—ฌ ๋ณด์•ˆ์„ฑ์ด ์—†๊ณ  ํด๋ผ์ด์–ธํŠธ์—... ์˜ˆ์ „์—๋Š” ์ด 300

    ๊ฐœ ๊นŒ์ง€ ์ €์žฅ ๊ฐ€๋Šฅํ–ˆ์œผ๋ฉฐ,
        ๊ฐ ๋„๋ฉ”์ธ ๋‹น ๊ฐฏ์ˆ˜ ์ œํ•œ(20๊ฐœ)์ด๋‚˜ ํฌ๊ธฐ ์ œํ•œ(4096Byte)์€ ์‚ฌ์‹ค์ƒ ๋ฌด์˜๋ฏธํ•ด์ ธ ๊ฐ€๊ณ ์žˆ๋‹ค.

     

        - ์ €์žฅ๋˜๋Š” ์œ„์น˜๋Š” ์‹œ์Šคํ…œ(์šด์˜์ฒด์ œ)์ด๋‚˜ ๋ธŒ๋ผ์šฐ์ €์— ๋”ฐ๋ผ ๋‹ค๋ฅด๋ฉฐ ์ผ๋ฐ˜์ ์ธ ํ˜•์‹(๊ณ„์ •๋ช…@๋„๋ฉ”์ธ)๋„ ๊พธ์ค€ํžˆ ๋ฐ”๋€Œ์–ด ๊ฐ€๊ณ  ์žˆ๋‹ค.

        - ์ฟ ํ‚ค๋Š” ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ฑฐ์ณ๊ฐ„ ์›น์‚ฌ์ดํŠธ ๋ฐ ๊ฐœ์ธ์˜ ์ •๋ณด๊ฐ€ ๊ธฐ๋ก๋˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐœ์ธ์˜ ์‚ฌ์ƒํ™œ์„ ์นจํ•ดํ•  ์†Œ์ง€๊ฐ€ ์žˆ์œผ๋ฉฐ, ์ด๋กœ ์ธํ•ด ์›น ๋ธŒ๋ผ์šฐ์ € ์ž์ฒด์— ์ฟ ํ‚ค ๊ฑฐ๋ถ€ ๊ธฐ๋Šฅ์ด ํฌํ•จ๋˜์–ด ์žˆ๋‹ค.
        ํ•˜์ง€๋งŒ, ์ฟ ํ‚ค ๊ฑฐ๋ถ€ ๊ธฐ๋Šฅ์„ ์„ค์ •ํ•˜๊ฒŒ ๋˜๋ฉด ์›น ๋ธŒ๋ผ์šฐ์ €์™€์˜ ์—ฐ๊ฒฐ์„ ์ง€์†์‹œํ‚ค์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋œ๋‹ค.
        (์‚ฌ์‹ค์ƒ ๊ฑฐ๋ถ€ํ•˜๋Š” ์˜๋ฏธ๊ฐ€ ์—†์Œ... ๋ฐ˜ ๊ฐ•์ œ์ )

        - ์ฟ ํ‚ค์˜ ๋™์ž‘ ๋ฐฉ์‹ 

        ์ฟ ํ‚ค์˜ ๋™์ž‘ ๋ฐฉ์‹์€ ์›น ์„œ๋ฒ„์™€ ์›น ๋ธŒ๋ผ์šฐ์ € ๊ฐ„์˜ ์ƒํ˜ธ ํ˜‘๋ ฅ์œผ๋กœ ์ด๋ฃจ์–ด์ง„๋‹ค. ์›น ์„œ๋ฒ„๊ฐ€ ์™ธ๋ถ€ ๋ธŒ๋ผ์šฐ์ €์˜ ์š”์ฒญ์— ์‘๋‹ตํ•  ๋•Œ HTTP ํ”„๋กœํ† ์ฝœ์— ์žˆ๋Š” HTTP ํ—ค๋” ์ฟ ํ‚ค ์ •๋ณด๋ฅผ ํฌํ•จ์‹œ์ผœ ํด๋ผ์ด์–ธํŠธ ์ชฝ์œผ๋กœ ๋ณด๋‚ธ๋‹ค.
        ๊ทธ๋ฆฌ๊ณ , ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์›น ์„œ๋ฒ„์— ์กด์žฌํ•˜๋Š” ํŽ˜์ด์ง€๋ฅผ ์š”๊ตฌํ•  ๋•Œ ๊ทธ ์ „์— ์ž์‹ ์ด ๋ฐฉ๋ฌธํ–ˆ์„ ๋•Œ ํ•ด๋‹น ํŽ˜์ด์ง€์— ๋Œ€ํ•ด ์›น ์„œ๋ฒ„๊ฐ€ ์›น ๋ธŒ๋ผ์šฐ์ € ์ชฝ์œผ๋กœ ์‹ฌ์–ด๋†“์•˜๋˜ ์ฟ ํ‚ค๋ฅผ ์›น ์„œ๋ฒ„๋กœ ๋‹ค์‹œ ๊ฑด๋„ค ์ฃผ์–ด์„œ ์ด์ „์ƒํƒœ๋ฅผ ์›น ์„œ๋ฒ„๊ฐ€ ์•Œ ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.

        - ์ฟ ํ‚ค(๊ฐ์ฒด)์˜ ํŒŒ๋ผ๋ฏธํ„ฐ(์†์„ฑ)

            ·name=value
            : ์ฟ ํ‚ค๋Š” ๋ฐ˜๋“œ์‹œ ์ด๋ฆ„์„ ํฌํ•จํ•ด์•ผ ํ•œ๋‹ค. ์ด๋ฆ„์€ ๋ณ€์ˆ˜๋ช…๊ณผ ๊ฐ™์€ ๋ชฉ์ ์œผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค.

            ·expires=date
            : ์œ ํšจ๊ธฐ๊ฐ„์„ ์ง€์ •ํ•œ๋‹ค.
            ๋‚ ์งœ๋ฅผ ์ƒ๋žตํ•  ๊ฒฝ์šฐ ๋ธŒ๋ผ์šฐ์ € ์ข…๋ฃŒ ์‹œ์ ๊นŒ์ง€ ์ฟ ํ‚ค๊ฐ€ ๋‚จ์•„์žˆ๊ฒŒ ๋œ๋‹ค. ์œ ํšจ๊ธฐ๊ฐ„ ์„ค์ •์€ ๊ทธ๋ฆฌ๋‹ˆ์น˜ ํ‘œ์ค€์‹œ(Wdy, DD-Mon-TT HH:MM:SS GNT)๋กœ ์„ค์ •ํ•˜๊ฒŒ ๋œ๋‹ค.

            ·path=path
            : ์›น ์„œ๋ฒ„์—์„œ ์ฟ ํ‚ค ๊ฐ’์ด ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ฐ„์— ์œ ํšจํ•œ ๋ฒ”์œ„๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์œผ๋กœ path ๊ฐ’์€ ์›น ์„œ๋ฒ„์˜ document root ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์„ค์ •ํ•œ๋‹ค.
            ์˜ˆ๋ฅผ ๋“ค์–ด... path ๊ฐ€ ใ€Ž/ใ€์ด๋ฉด (ใ€Ž"Path=/;"ใ€) ๋„๋ฉ”์ธ์˜ ๋ฃจํŠธ(/)์—์„œ ์‹œ์ž‘ํ•˜๋Š” ๋ชจ๋“  ๊ณณ์„ ์ ‘์†ํ•  ๋•Œ ํ•ด๋‹น ์ฟ ํ‚ค์˜ ๊ฐ‘์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.
            ์ƒ๋žตํ•  ๊ฒฝ์šฐ ํ˜„์žฌ ๋ฌธ์„œ์˜ ์œ„์น˜์™€ ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ ํ•˜์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ๊ฐ€ ์ฟ ํ‚ค์˜ ๋ฒ”์œ„๊ฐ€ ๋œ๋‹ค.

            ·domain=domain
            : ํ•œ์‚ฌ์ดํŠธ์—์„œ ๋งŒ๋“  ์ฟ ํ‚ค๊ฐ€ ๋‹ค๋ฅธ ์‚ฌ์ดํŠธ์— ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋„๋ฉ”์ธ ํ•ญ๋ชฉ์ด ํ•„์š”ํ•˜๋‹ค. ๋„๋ฉ”์ธ์€ ์ž๋™์œผ๋กœ ์‚ฌ์ดํŠธ์˜ ๊ธฐ๋ณธ ๋„๋ฉ”์ธ์œผ๋กœ ์„ค์ •๋œ๋‹ค.

            ·secure
            : ๋ฐ์ดํ„ฐ์˜ ์ „์†ก์— ๋ณด์•ˆ์ด ์š”๊ตฌ๋˜๋Š” ์ง€๋ฅผ ์ง€์ •ํ•œ๋‹ค. true๋Š” ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์•ˆ์ „ํ•˜๋‹ค๊ณ  ํŒ๋‹จํ•˜๋Š” ์„œ๋ฒ„๋งŒ ๋‚˜ํƒ€๋‚˜๊ฒŒ ๋œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’(default)์€ false ์ด๋‹ค.

        - ์ฟ ํ‚ค์˜ ๊ธฐ๋ณธ ์„ค์ •

            โ‘  Cooke ๊ฐ์ฒด ์ƒ์„ฑ
                Cookie c = new Cookie("์ฟ ํ‚ค์ด๋ฆ„","์ฟ ํ‚ค๊ฐ’");

            โ‘ก Cooke ๊ฐ์ฒด ์„ค์ •

                c.setMaxAge(์ฟ ํ‚ค์œ ํšจ์‹œ๊ฐ„ ์ดˆ ๋‹จ์œ„ ์„ค์ •)

            โ‘ข Cookie ๊ฐ์ฒด ๋“ฑ๋ก(์ถ”๊ฐ€)

                response.addCookie(c);

     

        - JSP ์—์„œ ์ฟ ํ‚ค๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‘ ๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.

            ์ฒซ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์€ 

            ใ€Žresponseใ€๊ฐ์ฒด์— ใ€ŽsetHeader()ใ€ ๋ฉ”์†Œ๋“œ๋ฅผ ์ด์šฉํ•˜์—ฌ ์ฟ ํ‚ค๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

            ํ•˜์ง€๋งŒ, ๊ถŒ์žฅํ•˜์ง€ ์•Š๋Š”๋‹ค.

            ex) response.setHeader("set_cookie","name=value, expirese=value, ...");

            //-- ์ด ๋ฐฉ๋ฒ•์€...
            //  Header ์— key ์™€ ๊ฐ’, key ์™€ ๊ฐ’, .... ์„ String Type ์œผ๋กœ ๋„˜๊ธฐ๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์—„๋ฐ€ํžˆ ๋งํ•˜์ž๋ฉด ์ฟ ํ‚ค๋ผ๋Š” ๊ฐ์ฒด๋ฅผ ๋„˜๊ธฐ๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋‹ค. ๊ณผ๊ฑฐ์—๋Š” ์ฟ ํ‚ค๋ผ๋Š” ํด๋ž˜์Šค๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ–ˆ์—ˆ๋‹ค.

            ๋‘ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์€

            ใ€ŽCookieใ€ ํด๋ž˜์Šค๋ฅผ ์ด์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.

            · String getCommet()

            : ์ฟ ํ‚ค์— ๋Œ€ํ•œ ์„ค๋ช…์„ ๊ฐ€์ ธ์˜จ๋‹ค.

            · String getDomatin()

            : ์ฟ ํ‚ค๊ฐ€ ์œ ํšจํ•œ ๋„๋ฉ”์ธ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค.

            · int getMaxAge()

            : ์ฟ ํ‚ค์˜ ์œ ํšจํ•œ ์‹œ๊ฐ„ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค.

            · String getName()

            : ์ฟ ํ‚ค์˜ ์ด๋ฆ„์„ ๊ฐ€์ ธ์˜จ๋‹ค.

            · String getPath()

            : ์ฟ ํ‚ค์˜ ์œ ํšจํ•œ ๋””๋ ‰ํ„ฐ๋ฆฌ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค.

            · String getSecure()

            : ์ฟ ํ‚ค์˜ ๋ณด์•ˆ ์„ค์ •์„ ๊ฐ€์ ธ์˜จ๋‹ค.

            · String getValue()

            : ์ฟ ํ‚ค์˜ ํ•ด๋‹น ๊ฐ’์„ ๊ฐ€์ ธ์˜จ๋‹ค.

            · int getVersion()

            : ์ฟ ํ‚ค์˜ ๋ฒ„์ „ ๊ฐ’์„ ๊ฐ€์ ธ์˜จ๋‹ค.

            · void setcomment(string purpose)
            : ์ฟ ํ‚ค์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์„ค์ •ํ•œ๋‹ค.

            · void setDomain(String Pattern)

            : ์ฟ ํ‚ค๊ฐ€ ์œ ํšจํ•œ ๋„๋ฉ”์ธ ์ •๋ณด๋ฅผ ์„ค์ •ํ•œ๋‹ค.

            · void setMaxAge(int expiry)

            : ์ฟ ํ‚ค๊ฐ€ ์œ ํšจํ•œ ์‹œ๊ฐ„ ์ •๋ณด๋ฅผ ์„ค์ •ํ•œ๋‹ค.

            · void setSecure(string url)

            : ์ฟ ํ‚ค์˜ ๋ณด์•ˆ ์„ค์ •๊ฐ’์„ ๊ตฌ์„ฑํ•œ๋‹ค.

            · void setValue(String newValue)

            : ์ฟ ํ‚ค์˜ ํ•ด๋‹น ๊ฐ’์„ ์„ค์ •ํ•œ๋‹ค.

            · void setVersion(int V)

            : ์ฟ ํ‚ค์˜ ๋ฒ„์ „ ๊ฐ’์„ ์„ค์ •ํ•œ๋‹ค.

     


        - JSP ์—์„œ ์ฟ ํ‚ค(Cookie) ์œ ํšจ์‹œ๊ฐ„ ์„ค์ •

            ใ€ŽsetMaxAge(int expiry)ใ€ ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ์œ ํšจ์‹œ๊ฐ„์„ ์„ค์ •ํ•œ

            · ใ€Žexpiryใ€๊ฐ€ ใ€Ž์Œ์ˆ˜ใ€์ผ ๋•Œ
            : ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ์ฟ ํ‚ค๊ฐ€ ์ œ๊ฑฐ๋œ๋‹ค.

            · ใ€Žexpiryใ€๊ฐ€ ใ€Ž0ใ€์ผ ๋•Œ

            : ์ƒ์„ฑ๊ณผ ๋™์‹œ์— ์ฟ ํ‚ค๊ฐ€ ์ œ๊ฑฐ๋œ๋‹ค.

            · ใ€Žexpiryใ€๊ฐ€ ใ€Ž์–‘์ˆ˜ใ€์ผ ๋•Œ

            : ์ดˆ ๋‹จ์œ„๋กœ ํ•ด๋‹น ์‹œ๊ฐ„๋งŒํผ ์ฟ ํ‚ค๊ฐ€ ์œ ์ง€๋œ๋‹ค.

            · ใ€ŽsetMaxAge()ใ€ ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ์œ ํšจ์‹œ๊ฐ„์„ ์„ค์ •ํ•˜์ง€ (๋ช…์‹œํ•˜์ง€)์•Š์€ ๊ฒฝ์šฐ ๊ธฐ๋ณธ์ ์œผ๋กœ ์Œ์‹œ๊ฐ€ ์„ค์ •๋˜์–ด ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ข…๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ์ฟ ํ‚ค๊ฐ€ ์œ ์ง€๋œ๋‹ค.


    โ—‹ ์„ธ์…˜(Session)

        - ์ฟ ํ‚ค์˜ ๊ฒฝ์šฐ ๋ธŒ๋ผ์šฐ์ €์— ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜์ง€๋งŒ(์ฆ‰, ๋กœ์ปฌ PC์˜ ํ•˜๋“œ๋””์Šคํฌ์— ์ €์žฅ) ์„ธ์…˜์€ ์„œ๋ฒ„์˜ ์›น ์ปจํ…Œ์ด๋„ˆ์˜ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๋Š”๊ฒƒ์œผ๋กœ

        ใ€Žjavax.servvlet.httpใ€ ํŒจํ‚ค์ง€์˜ ใ€ŽHttpSessionใ€ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ์„ธ์…˜์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค.

        ๋˜ํ•œ ์„ธ์…˜์€ ์„œ๋ฒ„์™€ ๊ด€๋ จ๋œ ์ •๋ณด๋ฅผ ๋…ธ์ถœํ•˜์ง€ ์•Š๊ธฐ ๋–„๋ฌธ์— ์ฟ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ใ€ŽHttpSessionใ€ ์ธํ„ฐํŽ˜์ด์Šค์˜ ์„ธ์…˜

    ์„ ํ†ตํ•œ ๊ด€๋ฆฌ๊ฐ€ ๋ณด๋‹ค ์•ˆ์ •์ (๋ณด์•ˆ์„ฑ ํ–ฅ์ƒ)์ด๋ผ ํ•  ์ˆ˜ ์žˆ๋‹ค.

     

        - Session ์ƒ์„ฑ 

        Session ์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํŽ˜์ด์ง€ ๋””๋ ‰ํ‹ฐ๋ธŒ(page directive)์˜ session ์†์„ฑ์„ ture ๋กœ ์„ค์ •ํ•œ๋‹ค.
        (๋ณ„๋„๋กœ ์„ค์ •ํ•˜์ง€ ์•Š์•„๋„ ์ž๋™์œผ๋กœ ๊ธฐ๋ณธ๊ฐ’ ์ ์šฉ. ์ฆ‰, ์‚ฌ์šฉํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ๋งŒ false ์„ค์ •.)

        ex) <%@ page session="true"%>

     

        - Session ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ฃผ์š” ๋ฉ”์†Œ๋“œ

            · String getId()

            : (ใ€Ž์„ธ์…˜์•„์ด๋””ใ€๋ผ๊ณ  ํ•œ๋‹ค. ์„ธ์…˜ ๊ณ ์œ  ID๋ฅผ ๋ฌธ์ž์—ด ํ˜•ํƒœ๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค.)

            · long getCreationTime()

            : ์„ธ์…˜์˜ ์ƒ์„ฑ๋œ ์‹œ๊ฐ„์„ ๊ตฌํ•œ๋‹ค.

              (์‹œ๊ฐ„์€ 1970๋…„ 1์›” 1์ผ ์ดํ›„ ํ˜๋Ÿฌ๊ฐ„ ์‹œ๊ฐ„์„ ์˜๋ฏธํ•œ๋‹ค.)

            · long getLastAccessedTime()

            : ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— ์„ธ์…˜์— ์ ‘๊ทผํ•œ ์‹œ๊ฐ„์„ ๊ตฌํ•œ๋‹ค.

            · int getMaxInactiveInerval()

            : ์„ธ์…˜ ์œ ์ง€ ์‹œ๊ฐ„์„ ์ดˆ๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ 30๋ถ„์œผ๋กœ ์ง€์ •๋œ๋‹ค.

            · void setMaxInactiveInerval(int interval)

            : ์„ธ์…˜์„ ์œ ์ง€ํ•  ์‹œ๊ฐ„์„ interval ์— ์„ค์ •๋œ ์ดˆ ๊ฐ’์œผ๋กœ ์„ค์ •ํ•œ๋‹ค.

            · void invalidate()

            : ํ˜„์žฌ ์„ธ์…˜์„ ์ข…๋ฃŒํ•œ๋‹ค. ์„ธ์…˜๊ณผ ๊ด€๋ จ๋œ ๋ชจ๋“  ๊ฐ’์„ ์‚ญ์ œํ•œ๋‹ค.

            · boolean isNew()

            : ํด๋ผ์ด์–ธํŠธ ใ€Ž์„ธ์…˜์•„์ด๋””ใ€๋ฅผ ํ• ๋‹นํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ใ€Žtrueใ€๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. 

              ์ƒˆ๋กœ์šด ์„ธ์…˜์ธ์ง€์˜ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

            · void setAttribue(String key, Objec value)

            : ์ฃผ์–ด์ง„ key ์†์„ฑ์˜ ๊ฐ’์„ value ๋กœ ์ง€์ •ํ•œ๋‹ค.

            · Object getAttribute(String key)

            : ์ฃผ์–ด์ง„ key ์†์„ฑ์˜ ๊ฐ’์„ ์–ป์–ด๋‚ธ๋‹ค.

            · void removeAttribue(String key)

            : ์ฃผ์–ด์ง„ key ์†์„ฑ์˜ ๊ฐ’์„ ์ œ๊ฑฐํ•œ๋‹ค.


        - ํ•œ๋ฒˆ ์ƒ์„ฑ๋œ ์„ธ์…˜์€ ์ข…๋ฃŒํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ง€์†์ ์œผ๋กœ ์œ ์ง€๋œ๋‹ค. (์ค‘๊ฐ„์— ์‚ฌ๋ผ์ง€์ง€ ์•Š์Œ)

    ๋‹จ, ์€ํ–‰ ์ธํ„ฐ๋„ท ๋ฑ…ํ‚น๊ณผ ๊ฐ™์€ ์„œ๋น„์Šค ์ด์šฉ ์‹œ ์ผ์ • ์‹œ๊ฐ„ ๋™์•ˆ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ฉด ๋กœํฌ์ธ ์ด ํ’€๋ฆฌ๋Š” ๊ฒƒ ๊ฐ™์€ ์ด์œ ๋Š” 
        ์ž„์˜๋กœ ์„ค์ •์„ ํ•ด๋‘์—ˆ๊ธฐ ๋•Œ๋ฌธ์ด๋ฉฐ, ์ด๋ ‡๊ฒŒ ์ž„์˜๋กœ ์„ธ์…˜์„ ์ข…๋ฃŒํ•˜๊ธฐ ์ „๊นŒ์ง€๋Š” ์ง€์†์ ์œผ๋กœ ์œ ์ง€๋œ๋‹ค.

        ์ด์™€ ๊ฐ™์€ ์„ฑ๊ฒฉ์œผ๋กœ ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๋Š” ๋™์•ˆ ์ง€์†์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ์˜ ์ €์žฅ ์žฅ์†Œ๋กœ๋Š” ์„ธ์…˜์ด ์ ํ•ฉ(์ ๋‹น)ํ•œ๋‹ค.

    โ€ป ์ฐธ๊ณ 

        - ์Šค์ฝ”ํ”„(scope) -> ๋Œ€๋ถ€๋ถ„์˜ ๊ต์žฌ์—์„œ life cycle (์ƒ๋ช…์ฃผ๊ธฐ)๋กœ ์„ค๋ช…ํ•จ.

        ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์€ page, request, session, application ์ด๋ผ๋Š” 4๊ฐœ์˜ ๊ฐ์ฒด์˜ ์˜์—ญ์€ ๊ฐ์ฒด์˜ ์œ ํšจ๊ธฐ๊ฐ„์ด๋ผ๊ณ ๋„ ๋ถˆ๋ฆฌ๋ฉฐ, ๊ฐ์ฒด๋ฅผ ๋ˆ„๊ตฌ์™€ ๊ณต์š”ํ•  ๊ฒƒ์ด๊ฐ€๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. 

            · page ์˜์—ญ

              ํ•œ ๋ฒˆ์˜ ์›น ๋ธŒ๋ผ์šฐ์ €(ํด๋ผ์ด์–ธํŠธ)์˜ ์š”์ฒญ์— ๋Œ€ํ•ด ํ•˜๋‚˜์˜ JSp ํŽ˜์ด์ง€๊ฐ€ ํ˜ธ์ถœ ๋˜๋ฉฐ ์›น ๋ธŒ๋ผ์šฐ์ €์˜ ์š”์ฒญ์ด ๋“ค์–ด์˜ค๋ฉด ์ด

    ๋•Œ... ๋‹จ ํ•œ๊ฐœ์˜ ํŽ˜์ด์ง€๋งŒ ๋Œ€์‘๋œ๋‹ค.

            · request ์˜์—ญ

              ํ•œ ๋ฒˆ์˜ ์›น ๋ธŒ๋ผ์šฐ์ €(ํด๋ผ์ด์–ธํŠธ)์˜ ์š”์ฒญ์— ๋Œ€ํ•ด ๊ฐ™์€ ์š”์ฒญ์„ ๊ณต์œ ํ•˜๋Š” ํŽ˜์ด์ง€๊ฐ€ ๋Œ€์‘๋˜๋ฉฐ ์›น๋ฅด๋ผ์šฐ์ €์˜ ํ•œ ๋ฒˆ์˜ ์š”

    ์ฒญ์ด ๋‹จ์ง€ ํ•œ ๊ฐœ์˜ ํŽ˜์ด์ง€๋งŒ ์š”์ฒญ๋  ์ˆ˜ ์žˆ๊ณ  ๊ฐ™์€ request ์˜์—ญ์ด๋ฉฐ ๋‘ ๊ฐœ์˜ ํŽ˜์ด์ง€๊ฐ€ ๊ฐ™์€ ์š”์ฒญ์„ ๊ณต์œ ํ•œ๋‹ค.

             (include ์•ก์…˜ ํƒœ๊ทธ, forward ์•ก์…˜ ํƒœ๊ทธ ์‚ฌ์šฉ ์‹œ)

            · seession ์˜์—ญ

              ํ•˜๋‚˜์˜ ์›น ๋ธŒ๋ผ์šฐ์ € ๋‹น ํ•œ๊ฐœ์˜ Session ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค. ๊ฐ™์€ ์›น ๋ธŒ๋ผ์šฐ์ € ๋‚ด์—์„œ๋Š” ์š”์ฒญ๋˜๋Š” ํŽ˜์ด์ง€๋“ค์ด ๊ฐ™์€ ๊ฐ

    ์ฒด๋ฅผ ๊ณต์œ ํ•œ๋‹ค.

            · applicaiton ์˜์—ญ

              ํ•˜๋‚˜์˜ ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋‹น ํ•œ ๊ฐœ์˜ application ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ํ™˜๊ฒฝ ์„ค์ •์—์„œ ์‚ฌ์šฉ๋œ๋‹ค. ๊ฐ™์€ ์›น ์–ดํ”Œ๋ฆฌ

    ์ผ€์ด์…˜์—์„œ ์š”์ฒญ๋˜๋Š” ํŽ˜์ด์ง€๋“ค์€ ๊ฐ™์€ ๊ฐ์ฒด๋ฅผ ๊ณต์œ ํ•œ๋‹ค.

     


    F_WebApp13: ์„ธ์…˜์ฒ˜๋ฆฌ-๋กœ๊ทธ์ธ

    ใ„ด/WebApp13/WebContent

    ใ„ดใ„ดTestSession01.jsp

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// ์ตœ์ดˆ ์š”์ฒญ์ผ ๊ฒฝ์šฐ... ์•„๋ฌด๊ฒƒ๋„ ์—†์ง€๋งŒ...
    	// TEstSession01_ok.jsp ํŽ˜์ด์ง€์—์„œ
    	// ๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„์— ์š”์ฒญ๋œ ํŽ˜์ด์ง€๋ผ๋ฉด...
    	// session์˜ userId์— superman ์„ 
    	//			 userName ์— ๋ฌธ์ •ํ™˜์„ ๋‹ด์•„์„œ ๋ณด๋‚ธ ์ƒํ™ฉ
    	
    	String userId = (String)session.getAttribute("userId");		// "superman"
    	String userName = (String)session.getAttribute("userName"); // "๋ฌธ์ •ํ™˜"
    	//-- ใ€Žsession.getAttribute("userId");ใ€๋Š”
    	//	Object ํƒ€์ž…์„ ๋ฐ˜ํ™˜ํ•˜๋ฏ€๋กœ
    	//	String ํƒ€์ž…์œผ๋กœ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ณผ์ • ํ•„์š”(๋‹ค์šด ์บ์ŠคํŒ…)
    	
    	// ์ถ”๊ฐ€~!!!
    	// ์„ธ์…˜ ํ™œ์„ฑํ™” ์‹œ๊ฐ„ ๋ณ€๊ฒฝ -----------------------------------------------------------
    	
    	// โ€ป ์„ธ์…˜ ๊ธฐ๋ณธ(default) ์‹œ๊ฐ„์€ 1800์ดˆ.
    	
    	session.setMaxInactiveInterval(10);
    	//--- ์„ธ์…˜์ด ์œ ์ง€๋˜๋Š” ์‹œ๊ฐ„์„ 10์ดˆ๋กœ ์„ค์ •ํ•œ ์ƒํƒœ.
    	//	์ด๋กœ ์ธํ•ด...
    	//	๋กœ๊ทธ์ธ ํ›„ 10 ์ดˆ ๋™์•ˆ ์•„๋ฌด ์•ก์…˜๋„ ์—†๋Š” ์ƒํƒœ์—์„œ...
    	//	๋‹ค์‹œ ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜๋ ค ํ•˜๊ฑฐ๋‚˜, ํŽ˜์ด์ง€ ์ƒˆ๋กœ๊ณ ์นจ์„ ์ˆ˜ํ–‰ํ•˜๋ฉด
    	//	๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
    	
    	// ------------------------------------------------------------์„ธ์…˜ ํ™œ์„ฑํ™” ์‹œ๊ฐ„ ๋ณ€๊ฒฝ
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSession01</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/MemberScore.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <style type="text/css">
    	/* .btnMenu{border: 1px solid gray;border-radius: 3px;font-size: 8px;width: 60px;height: 20px;} */
    	.btn_box [type="button"], .btn_box [type="reset"], .btn{min-width: 80px;}
    </style>
    <script type="text/javascript">
    function sendIt()
    {
    	// ํ™•์ธ
    	//alert("ํ•จ์ˆ˜ ํ˜ธ์ถœ");
    	
    	var f = document.myForm;
    	
    	if(!f.userId.value)
    	{
    		alert("์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค~!!!");
    		f.userId.focus();
    		return;
    	}
    	
    	if(!f.userPwd.value)
    	{
    		alert("ํŒจ์Šค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค~!!!");
    		f.userPwd.focus();
    		return;
    	}
    	f.submit();	
    }
    </script>
    </head>
    <body class="section">
    <!-- **Session์€ ์„œ๋ฒ„์ชฝ ์ž์›์ด๋ฏ€๋กœ ๋จผ์ € ๋ณผ ๊ฒƒ** -->
    <div>
    	<h1>์„ธ์…˜ ์ฒ˜๋ฆฌ - ๋กœ๊ทธ์ธ</h1>
    </div>
    
    <div class="layout">
    	<div class="tbl_box">
    		<table>
    			<tr>
    				<td class="btn_box" style="display:flex;align-items: center;">
    					<a href="">
    						<button type="button" class="btnMenu btn01">๊ฒŒ์‹œํŒ</button>
    					</a> |
    					<%
    					if(userId == null)
    					{
    					%>
    					<a href="">
    						<button type="button" class="btnMenu btn02">์ผ์ •๊ด€๋ฆฌ</button>
    					</a> |
    					<a href="">
    						<button type="button" class="btnMenu btn02">์นœ๊ตฌ๊ด€๋ฆฌ</button>
    					</a> |...
    					<%
    					}
    					else
    					{
    					%>
    					<a href="Sca.jsp">
    						<button type="button" class="btnMenu btn01">์ผ์ •๊ด€๋ฆฌ</button>
    					</a> |
    					<a href="Fir.jsp">
    						<button type="button" class="btnMenu btn01">์นœ๊ตฌ๊ด€๋ฆฌ</button>
    					</a> |...
    					<%
    					}
    					%>
    				</td>
    			</tr>
    		</table>
    	</div>
    	<div class="tbl_box">
    		<%
    		if(userId == null)
    		{
    		%>
    		<form action="TestSession01_ok.jsp" method="post" name="myForm">
    			<table>
    				<tr>
    					<th>์•„์ด๋””</th>
    					<td>
    						<input type="text" name="userId" class="txt">
    					</td>
    				</tr>
    				<tr>
    					<th>ํŒจ์Šค์›Œ๋“œ</th>
    					<td>
    						<!-- <input type="text"> -->
    						<input type="text" name="userPwd" class="txt">
    					</td>
    				</tr>
    				<tr>
    					<td colspan="2">
    						<button type="button" class="btn" style="width:100%;" onclick="sendIt();">๋กœ๊ทธ์ธ</button>
    					</td>
    				</tr>
    			</table>
    		</form>
    		<%
    		}
    		else
    		{
    		%>
    		<h2><%=userName %>(<%=userId %>)๋‹˜, ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.</h2>
    		<p>์ด์ œ, ์ผ์ •๊ด€๋ฆฌ์™€ ์นœ๊ตฌ๊ด€๋ฆฌ ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.</p>
    		<p class="btn_box">
    			<a href="Logout.jsp">
    				<button type="button" class="btnMenu btn01">๋กœ๊ทธ์•„์›ƒ</button>
    			</a>
    		</p>
    		<%
    		}
    		%>
    	</div>
    </div>
    
    </body>
    </html>

    ใ„ดใ„ดTestSession01_ok.jsp

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// TestSession01_ok.jsp
    	
    	// ์ด์ „ ํŽ˜์ด์ง€(TestSession01.jsp)๋กœ ๋ถ€ํ„ฐ ๋„˜์–ด์˜จ ๋ฐ์ดํ„ฐ ์ˆ˜์‹ 
    	// -> userId, userPwd
    	String userId = request.getParameter("userId");
    	String userPwd = request.getParameter("userPwd");
    	
    	// DB ํ™œ์šฉ -> dao ๋กœ๊ทธ์ธ ์ฒ˜๋ฆฌ -> dao ํ™œ์šฉ
    	// -> ๋กœ๊ทธ์ธ ๊ด€๋ จ ํ…Œ์ด๋ธ” ๋ฐ์ดํ„ฐ์™€ ๋น„๊ต -> ์ตœ์ข…์ ์œผ๋กœ ๋กœ๊ทธ์ธ ์•ก์…˜ ์ฒ˜๋ฆฌ
    	
    	String memberId = "superman";
    	String memberPwd = "1234567";
    	String memberName = "๋ฌธ์ •ํ™˜";
    	
    	if(userId.equals(memberId) && userPwd.equals(memberPwd))
    	{
    		// ๋กœ๊ทธ์ธ ์•ก์…˜ ์ฒ˜๋ฆฌ
    		session.setAttribute("userId", userId);			//-- session ์˜ userId -> superman 
    		session.setAttribute("userName", memberName);	//-- session ์˜ userName -> ๋ฌธ์ •ํ™˜
    		
    		// ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํŽ˜์ด์ง€๋ฅผ ๋‹ค์‹œ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๋„๋ก ์•ˆ๋‚ด
    		response.sendRedirect("TestSession01.jsp");
    		
    	}
    	
    %>
    
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSession01_ok.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div class="layout">
    	<h1>๋กœ๊ทธ์ธ ์‹คํŒจ~!!!</h1>
    	<hr>
    </div>
    
    <a href="TestSession01.jsp">โ–ถ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋Œ์•„๊ฐ€๊ธฐ</a>
    
    </body>
    </html>

    ใ„ดใ„ดLogout.jsp

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// Logout.jsp
    	//-- ์„ธ์…˜์˜ ๋‚ด์šฉ์„ ์—†์•  ๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌ
    	//	 ์ดํ›„ ... ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋‹ค์‹œ ์š”์ฒญํ•  ํŽ˜์ด์ง€ ์•ˆ๋‚ด
    	
    	session.removeAttribute("userId");
    	session.removeAttribute("userName");
    	// ์„ธ์…˜์˜ ์‚ฌ์šฉ์ž์•„์ด๋””์™€ ์ด๋ฆ„ ์‚ญ์ œ
    	
    	// ๊ธฐ์กด ์„ธ์…˜์— ์ €์žฅ๋˜์–ด ์žˆ๋Š” ๋ชจ๋“  ํ•ญ๋ชฉ์„ ์ œ๊ฑฐํ•˜๊ณ  ์„ผ์…˜์„ ์ดˆ๊ธฐํ™”
    	session.invalidate();
    	
    	// ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋‹ค์‹œ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋ฅผ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๋„๋ก ์•ˆ๋‚ด
    	response.sendRedirect("TestSession01.jsp");
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Logout.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div class="layout">
    	<h1>์•ˆ์ „ํ•˜๊ฒŒ~!๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค~!!!</h1>
    </div>
    
    </body>
    </html>

    F_WebApp14: ํšŒ์›๊ฐ€์ž…01-03(์ด๋ฆ„,์ „ํ™”๋ฒˆํ˜ธ)(์•„์ด๋””,ํŒจ์Šค์›Œ๋“œ),(์ด๋ฆ„,์ „ํ™”๋ฒˆํ˜ธ,์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ ์ถœ๋ ฅ)

    ใ„ด/WebApp14/WebContent

    ใ„ดใ„ดTestSession01.jsp_ํšŒ์›๊ฐ€์ž…01 (์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ)

    <%@ page contentType="text/html; charset=UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSession01.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <!-- 
    	โ—‹ TestSession01.jsp ์—์„œ TestSession02.jsp ํŽ˜์ด์ง€๋กœ 
    		์ด๋ฆ„๊ณผ ์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ ์ „์†ก
    		
    		TestSession02.jsp์—์„œ TestSession03.jsp ํŽ˜์ด์ง€๋กœ
    		์•„์ด๋””์™€ ํŒจ์Šค์›Œ๋“œ๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ 
    		์•ž์—์„œ ์ „๋‹ฌ๋ฐ›์€ ์ด๋ฆ„๊ณผ ์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ํ•จ๊ป˜ ์ „์†ก
    		
    		TestSession03.jsp ์—์„œ ์ „๋‹ฌ๋ฐ›์€ ์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ, ์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ ์ถœ๋ ฅ
    		
    		01 ---------------- 02 ----------------- 03
    		์ด๋ฆ„, ์ „ํ™”			์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ	์ด๋ฆ„, ์ „ํ™”, ์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ
    		์ž…๋ ฅ				์ž…๋ ฅ				์ถœ๋ ฅ
    		
    							-getParameter		- getAttribute
    		
    	โ€ป ์ฆ‰, 01์—์„œ 02๋กœ ๋„˜๊ฒจ๋ฐ›์„ ๋• getParameter
    		02์—์„œ 03์œผ๋กœ ๋„˜๊ฒจ๋ฐ›์„ ๋• getParmeter ์™€ getAttribute ๋กœ ์„ธ์…˜ ํ™œ์šฉ
    		01์—์„œ 03์œผ๋กœ ์ง์ ‘ ๋„˜๊ฒจ์ค„ ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์„ธ์…˜(session)์— ์ €์žฅ
    		
    	โ€ป session ์™ธ์— input ํƒœ๊ทธ hidden ์†์„ฑ์„ ์ด์šฉํ•œ ์ •๋ณด ์ „๋‹ฌ ๊ฐ€๋Šฅ~!!!
     -->
    
    <div>
    	<!-- <h1>TestSession01.jsp -> TestSession02.jsp -> TestSession03.jsp</h1> -->
    	<h2>ํšŒ์›๊ฐ€์ž…01 (์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ)</h2>
    	<h2>(TestSession01.jsp)</h2>
    	<hr>
    </div>
    
    <div class="layout">
    	<div class="tbl_box">
    		<form action="TestSession02.jsp" method="post" name="form01">
    			<table>
    				<tr>
    					<th>์ด๋ฆ„</th>
    					<td><input type="text" id="userName" name="userName"></td>
    				</tr>
    				<tr>
    					<th>์ „ํ™”</th>
    					<td><input type="text" id="userTel" name="userTel"></td>
    				</tr>
    				<tr class="btn_box" style="display: contents;">
    					<td colspan="2">
    						<a href="javascript:formCheck01();"><button type="button" style="width: 100%;">์ž…๋ ฅ</button></a>
    					</td>
    				</tr>
    			</table>
    		</form>
    	</div>
    </div>
    <script type="text/javascript">
    function formCheck01()
    {
    	//alert("ํ™•์ธ");
    	
    	var f = document.form01;
    	
    	if(!f.userName.value)
    	{
    		alert("์ด๋ฆ„์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
    		f.userName.focus();
    		return;
    	}
    	
    	if(!f.userTel.value)
    	{
    		alert("์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
    		f.userTel.focus();
    		return;
    	}
    	
    	f.submit();
    }
    </script>
    </body>
    </html>

    ใ„ดใ„ดTestSession02.jsp_ํšŒ์›๊ฐ€์ž…02 (์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ)

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// ์ด์ „ ํŽ˜์ด์ง€(TestSession01.jsp)๋กœ ๋ถ€ํ„ฐ ๋„˜์–ด์˜จ ๋ฐ์ดํ„ฐ ์ˆ˜์‹ 
    	// -> userName, userTel
    
    	request.setCharacterEncoding("UTF-8");
    
    	String name = request.getParameter("userName");
    	String tel = request.getParameter("userTel");
    	
    	// check~!!
    	// ์ถ”๊ฐ€
    	// ์„ธ์„ ์œผ๋กœ ๊ฐ’ ๋ณด๋‚ด๊ธฐ
    	session.setAttribute("userName", name);
    	session.setAttribute("userTel", tel);
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSession02.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div>
    	<h2>ํšŒ์›๊ฐ€์ž…02 (์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ)</h2>
    	<h2>(TestSession02.jsp)</h2>
    	<hr>
    </div>
    
    <div class="layout">
    	<div class="tbl_box">
    		<form action="TestSession03.jsp" method="post" name="form02">
    			<table>
    				<tr>
    					<th>์•„์ด๋””</th>
    					<td><input type="text" id="userId" name="userId"></td>
    				</tr>
    				<tr>
    					<th>ํŒจ์Šค์›Œ๋“œ</th>
    					<td><input type="text" id="userPwd" name="userPwd"></td>
    				</tr>
    				<tr class="btn_box" style="display: contents;">
    					<td colspan="2">
    						<a href="javascript:formCheck02();"><button type="button" style="width: 100%;">์ž…๋ ฅ</button></a>
    					</td>
    				</tr>
    			</table>
    			<%-- <input type="text" id="userName" name="userName" value="<%=name%>">
    			<input type="text" id="userTel" name="userTel" value="<%=tel%>"> --%>
    		</form>
    	</div>
    </div>
    <script type="text/javascript">
    function formCheck02()
    {
    	//alert("ํ™•์ธ");
    	
    	var f = document.form02;
    	
    	if(!f.userId.value)
    	{
    		alert("์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
    		f.userName.focus();
    		return;
    	}
    	
    	if(!f.userPwd.value)
    	{
    		alert("์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
    		f.userPwd.focus();
    		return;
    	}
    	
    	f.submit();
    }
    </script>
    </body>
    </html>

    ใ„ดใ„ดTestSession03.jsp_์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ, ์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ ์ถœ๋ ฅ

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// ์ด์ „ ํŽ˜์ด์ง€(TestSession02.jsp)๋กœ ๋ถ€ํ„ฐ ๋„˜์–ด์˜จ ๋ฐ์ดํ„ฐ ์ˆ˜์‹ 
    	// -> userId, userPwd
    
    	request.setCharacterEncoding("UTF-8");
    
    	String id = request.getParameter("userId");
    	String pwd = request.getParameter("userPwd");
    	
    	//String name = request.getParameter("userName");
    	//String tel = request.getParameter("userTel");
    	
    	// ์„ธ์…˜์—์„œ ๊ฐ’ ๊ฐ€์ ธ์˜ค๊ธฐ
    	String name = (String)session.getAttribute("userName");
    	String tel = (String)session.getAttribute("userTel");
    	
    	session.removeAttribute("userName");
    	session.removeAttribute("userTel");
    	
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSession03.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div>
    	<h2>์ด๋ฆ„, ์ „ํ™”๋ฒˆํ˜ธ, ์•„์ด๋””, ํŒจ์Šค์›Œ๋“œ ์ถœ๋ ฅ</h2>
    	<h2>(TestSession03.jsp)</h2>
    	<hr>
    </div>
    
    <div class="layout">
    	<div class="tbl_box">
    		<form action="TestSession03.jsp" method="post" name="form02">
    			<table>
    				<tr>
    					<th>์ด๋ฆ„</th>
    					<td><%=name %></td>
    				</tr>
    				<tr>
    					<th>์ „ํ™”</th>
    					<td><%=tel %></td>
    				</tr>
    				<tr>
    					<th>์•„์ด๋””</th>
    					<td><%=id%></td>
    				</tr>
    				<tr>
    					<th>ํŒจ์Šค์›Œ๋“œ</th>
    					<td><%=pwd%></td>
    				</tr>
    			</table>
    		</form>
    	</div>
    </div>
    
    </body>
    </html>

    F_WebApp15: ์ฟ ํ‚ค ์„ค์ • ๋ฐ ์ถ”๊ฐ€, ์ฟ ํ‚ค ์ •๋ณด ์–ป์–ด๋‚ด๊ธฐ, ์ฟ ํ‚ค ์ •๋ณด ์‚ญ์ œ/ Application์„ ํ™œ์šฉํ•œ ์ ‘์†์ž ์ˆ˜ ์ฒดํฌ

    ใ„ด/WebApp15/WebContent

    ใ„ดใ„ดTestSetCookie.jsp_์ฟ ํ‚ค ์ •๋ณด ์–ป์–ด๋‚ด๊ธฐ

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	request.setCharacterEncoding("UTF-8");
    
    	Cookie[] ck = request.getCookies();
    	
    	
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestGetCookie.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    	
    <div>
    	<h1>์ฟ ํ‚ค ์ •๋ณด ์–ป์–ด๋‚ด๊ธฐ</h1>
    	<hr>
    </div>
    
    <div class="layout">
    	<div class="tbl_box">
    		<table class="table">
    			<tr>
    				<th style="width: 120px;">์ฟ ํ‚ค ์ด๋ฆ„</th>
    				<th>์ฟ ํ‚ค ๊ฐ’</th>
    			</tr>
    			<%
    			for (Cookie c : ck)
    			{
    			%>
    			<tr>
    				<td><%= c.getName() %></td>
    				<td><%= c.getValue() %></td>
    			</tr>
    			<%
    			}
    			%>
    		</table>
    	</div>
    	
    	<div class="layout">
    		<a href="TestSetCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ์„ค์ •</button></a>
    		<a href="TestRemoveCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ์‚ญ์ œ</button></a>
    	</div>
    </div>
    
    </body>
    </html>

    ใ„ดใ„ดTestRemoveCookie.jsp_์ฟ ํ‚ค ์ •๋ณด ์‚ญ์ œํ•˜๊ธฐ

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	request.setCharacterEncoding("UTF-8");
    
    	/* **
    	์ฟ ํ‚ค๋Š” ์ œ๊ฑฐ๊ฐ€ ๋”ฐ๋กœ ์—†์Œ. -> ๋น„์–ด์žˆ๋Š” ์ฟ ํ‚ค๋กœ ๋ฎ์–ด์”€
    	** */
    	
    	// ๋น„์–ด์žˆ๋Š” ๋‚ด์šฉ์œผ๋กœ ๊ธฐ์กด์˜ ์ฟ ํ‚ค๋ฅผ ๋ฎ์–ด์“ฐ๊ธฐํ•˜๋Š” ๊ฐœ๋…
    	Cookie killCookie = new Cookie("cookie_test",  "");	// ์ œ๊ฑฐ ํ•˜๊ณ ์ž ํ•˜๋Š” ์ฟ ํ‚ค ์ด๋ฆ„๊ณผ ๊ฐ™์•„์•ผ ํ•จ
    	
    	killCookie.setMaxAge(0);
    	response.addCookie(killCookie);
    	// ์ฒ˜์Œ ์ฟ ํ‚ค๋ฅผ ๊ตฌ์„ฑํ•  ๋•Œ์—๋„ ใ€ŽaddCookie()ใ€๋กœ ์ฒ˜๋ฆฌํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์—
    	//	์‚ญ์ œํ•  ใ„ฑ๋•Œ๋„  ๊ฐ™์€ ์ด๋ฆ„์˜ ์ฟ ํ‚ค๋ฅผ ใ€ŽaddCookie()ใ€๋กœ ์ฒ˜๋ฆฌํ•ด์•ผ ์•ˆ์ •์ ์œผ๋กœ ์‚ญ์ œ.
    	//	์ฆ‰, ๋‚ด์šฉ์ด ํฌํ•จ๋œ ์ฟ ํ‚ค๋ฅผ ์‹ฌ์—ˆ๋‹ค๊ฐ€..
    	//	์ด๋ฒˆ์—๋Š” ๋‚ด์šฉ์ด ๋น„์–ด์žˆ๋Š” ์ฟ ํ‚ค๋ฅผ ์‹ฌ๋Š” ๊ฐœ๋….
    	
    	//โ€ป ์—ฌ๊ธฐ์„œ ์ฟ ํ‚ค ์‚ญ์ œ๋Š” ํด๋ผ์ด์–ธํŠธ ์ž…์žฅ์—์„œ์˜ ์‚ญ์ œ์ด๋‹ค.
    	// ํ•œ ๋ช…์˜ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ฟ ํ‚ค๋ฅผ ์‚ญ์ œํ–ˆ๋‹ค๊ณ  ํ•ด์„œ
    	// ๋‹ค๋ฅธ ํด๋ผ์ด์–ธํŠธ๋“ค์˜ ์ฟ ํ‚ค๋„ ์‚ญ์ œ๋˜๋ฉด ์•ˆ๋˜๊ธฐ ๋•Œ๋ฌธ์—
    	// ์ด ์ฟ ํ‚ค์˜ ์ •๋ณด๋Š” ๋กœ์ปฌ PC์—์„œ ์ปจํŠธ๋กค ํ•˜๊ฒŒ ๋œ๋‹ค.(๋ธŒ๋ผ์šฐ์ €๊ฐ€...)
    	
    	
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestRemoveCookie.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    	
    <div>
    	<h1>์ฟ ํ‚ค ์ •๋ณด ์‚ญ์ œํ•˜๊ธฐ</h1>
    	<hr>
    </div>
    
    <div class="layout">
    	<h2>์„ฑ๊ณต์ ์œผ๋กœ ์ฟ ํ‚ค๋ฅผ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค~!!!</h2>
    
    	<div class="btn_box">
    		<a href="TestSetCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ์„ค์ •</button></a>
    		<a href="TestGetCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ํ™•์ธ</button></a>
    	</div>
    </div>
    
    </body>
    </html>

    ใ„ดใ„ดTestSetCookie.jsp_์ฟ ํ‚ค ์„ค์ • ๋ฐ ์ถ”๊ฐ€

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	request.setCharacterEncoding("UTF-8");
    
    	// ์ฟ ํ‚ค ์ƒ์„ฑ(์„œ๋ฒ„์— ์ƒ์„ฑ๋œ ์ฟ ํ‚ค)
    	Cookie c = new Cookie("cookie_test", "studyCookie");
    	/* **์ฟ ํ‚ค๋Š” ์„œ๋ธ”๋ฆฟ์ปจํ…Œ์ด๋„ˆ(์„œ๋ฒ„)์— ๋งŒ๋“ค์–ด์ง** */
    	
    	// ์ฟ ํ‚ค ์„ค์ • (์„œ๋ฒ„์— ์ƒ์„ฑ๋œ ์ฟ ํ‚ค์— ๋Œ€ํ•œ ์„ค์ •)
    	c.setMaxAge(3600);		// ์ฟ ํ‚ค 1์‹œ๊ฐ„ ์œ ์ง€
    	
    	// ์ฟ ํ‚ค ์ถ”๊ฐ€ (์„œ๋ฒ„์—์„œ ์ƒ์„ฑ๋˜๊ณ  ์„ค์ •๋œ ์ฟ ํ‚ค๋ฅผ ํด๋ผ์ด์–ธํŠธ์— ์ „๋‹ฌ(์‹ฌ๊ธฐ))
    	response.addCookie(c);
    	
    	
    	
    	
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestSetCookie.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div>
    	<h1>์ฟ ํ‚ค ์„ค์ • ๋ฐ ์ถ”๊ฐ€</h1>
    	<hr>
    </div>
    
    <div class="layout">
    	<div class="btn_box">
    		<a href="TestGetCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ํ™•์ธ</button></a>
    		<a href="TestRemoveCookie.jsp"><button type="button" class="btn">์ฟ ํ‚ค ์ •๋ณด ์‚ญ์ œ</button></a>
    	</div>
    </div>
    
    </body>
    </html>

    ใ„ดใ„ด TestApplication.jsp_Application์„ ํ™œ์šฉํ•œ ์ ‘์†์ž ์ˆ˜ ์ฒดํฌ

    <%@ page contentType="text/html; charset=UTF-8"%>
    <%
    	// ์ ‘์†์ž ์ˆ˜
    	int n = 0;
    
    	String count =(String)application.getAttribute("count");
    	
    	if(count != null)
    		n = Integer.parseInt(count);
    	n++;
    	
    	application.setAttribute("count", Integer.toString(n));
    	
    	String realPath = application.getRealPath("/");
    	application.log("์ ‘์†์ž: "+request.getRemoteAddr());
    	
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>TestApplication.jsp</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    	
    <div>
    	<h1>Application์„ ํ™œ์šฉํ•œ ์ ‘์†์ž ์ˆ˜ ์ฒดํฌ</h1>
    	<hr>
    </div>
    
    <div class="layout">
    	<h2>์ด ์ ‘์†์ž: <%=n %></h2>
    	<h2 style="word-wrap:break-word;">์›น ์„œ๋ฒ„ ์‹ค์ œ ๊ฒฝ๋กœ<%=realPath %></h2>
    </div>
    	
    </body>
    </html>

     

     

    โ– โ– โ–  Emmet(์—๋ฐ‹) โ– โ– โ– 

    /* ** html ์ƒ์‚ฐ์„ฑ ํ–ฅ์ƒ ๋„๊ตฌ** */

     


    โ—‹ ๊ฐœ์š”

        - ๊ธฐ์กด์—๋Š” Zen Coding(์  ์ฝ”๋”ฉ) ์ด๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ์‚ฌ์šฉ๋˜์—ˆ๋‹ค.

        - ์ดํ›„... Goolge์—์„œ ์ด ๋„๊ตฌ๋ฅผ ์ˆ˜์šฉํ•˜๋ฉด์„œ emmet ์ด๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค.

        - HTML ์ƒ์‚ฐ์„ฑ ํ–ฅ์ƒ ๋„๊ตฌ(HTML ์ฝ”๋”ฉ์„ ๋น ๋ฅด๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•œ ํ”Œ๋Ÿฌ๊ทธ์ธ)

        - CSS ์„ ํƒ์ž ์‚ฌ์šฉ(CSS3 ์ง€์›)

            -> HTML ์„ CSS ์„ ํƒ์ž๋ฅผ ํ†ตํ•ด ๊ฒ€์ƒ‰ํ•˜๋Š” ๋ฐฉ๋ฒ• ๋Œ€์‹ 

            CSS ์„ ํƒ์ž๋ฅผ ํ†ตํ•ด HTML ์„ ์ƒ์„ฑํ•˜๋„๋ก ํ•˜๋Š” ๊ฐœ๋….

    โ—‹ ํ™˜๊ฒฝ ์„ค์ •

        - ๋Œ€๋ถ€๋ถ„์˜ ํˆด์—์„œ ์ง€์›ํ•˜๊ณ  ์žˆ์Œ

        (โ€ป ๊ทธ๋ฆฌ๊ณ  ๋Œ€๋ถ€๋ถ„์˜ ํŽธ์ง‘๊ธฐ ๋‚ด์—์„œ์˜ ์•ก์…˜ ํ‚ค: Ctrl + E)
        

        - https://emmet.io/

            โ‘  ๋ฉ”์ธ ํŽ˜์ด์ง€ ์ขŒ์ธก์— ์žˆ๋Š” Download ๋ฉ”๋‰ด ํด๋ฆญ

                -> https://emmet.io/download/ ํŽ˜์ด์ง€๋กœ ์ด๋™

            โ‘ก Download ๋ฆฌ์ŠคํŠธ๋“ค ์ค‘ ๋ณธ์ธ์ด ์‚ฌ์šฉํ•  ํŽธ์ง‘ํˆด์˜ ๋ฉ”๋‰ด ํด๋ฆญ

            โ‘ข Installation ํ•ญ๋ชฉ์—์„œ ์ œ์‹œํ•œ ์ˆœ์„œ๋Œ€๋กœ ์ง„ํ–‰

     

    โ€ป ํŠน์ด์‚ฌํ•ญ
    
        Emmet ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜ ์ดํ›„ ์ดํด๋ฆฝ์Šค ๊ธฐ๋ณธ ๋‹จ์ถ•ํ‚ค์™€ ์ค‘๋ณต๋˜๋Š” ํ•ญ๋ชฉ์ด ์กด์žฌํ•จ.
    
                                ------------------
                                    Ctrl + D
        ==> ๋‹จ์ถ•ํ‚ค ์žฌ์„ค์ •
            (์ดํด๋ฆฝ์Šค > ์œˆ๋„์šฐ > ์„ค์ • > General > keys)

    F_EmmetApp

    ใ„ด/EmmetApp/WebContent

    ใ„ดใ„ดEmmetTest01.html_โ€ป ๊ธฐ๋Šฅ ์ ์šฉ ์•ก์…˜ ํ‚ค -> Ctrl + E

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>EmmetTest01.html</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body class="section">
    
    <div>
    	<h1>โ€ป ๊ธฐ๋Šฅ ์ ์šฉ ์•ก์…˜ ํ‚ค -> Ctrl + E</h1>
    	<hr>
    </div>
    
    <div class="layout">
    
    <ul>
    	<li>
    		<h2>1. ํƒœ๊ทธ ์„ ํƒ์ž</h2>
    
    		div
    		<xmp>
    			<div></div>
    		</xmp>
    		
    		div{๋„ฃ์„๋‚ด์šฉ}
    		<xmp>
    			<div>๋„ฃ์„๋‚ด์šฉ</div>
    		</xmp>
    		
    		<h3>emmet์œผ๋กœ ๋งŒ๋“ค๊ณ  ์†์„ฑ๊ฐ’ ์‚ฌ์ด๋ฅผ 'tab'์œผ๋กœ ์ด๋™๊ฐ€๋Šฅ</h3>
    		a
    		<a href="http://www.naver.com">๋„ค์ด๋ฒ„</a>
    		
    		img
    		<xmp><img src="" alt="" /></xmp>
    		
    		table
    		<xmp>
    			<table></table>
    		</xmp>
    		
    		span
    		<xmp><span></span></xmp>
    		
    		p
    		<xmp>
    			<p></p>
    		</xmp>
    	</li>
    	<li>
    		<h2>2. ์•„์ด๋”” ์„ ํƒ์ž</h2>
    		
    		div#box
    		<xmp>
    			<div id="box"></div>
    		</xmp>
    		
    		div#box{kkk}
    		<xmp>
    			<div id="box">kkk</div>
    		</xmp>
    		
    		div#box.happy{kkk}
    		<xmp>
    			<div id="box" class="happy">kkk</div>
    		</xmp>
    		
    		<h3>-> div๋Š” ๋ณ„๋„์˜ ์ž‘์„ฑ์—†์ด๋„ div๋กœ ๊ตฌ์„ฑ๋จ</h3>
    		#box
    		<xmp>
    			<div id="box"></div>
    		</xmp>
    		
    		#box{1234}
    		<xmp>
    			<div id="box">1234</div>
    		</xmp>
    
    	</li>
    	<li>
    		<h2>3. ํด๋ž˜์Šค ์„ ํƒ์ž</h2>
    		
    		div.items
    		<xmp>
    			<div class="items"></div>
    		</xmp>
    		
    		div.items{aaa}
    		<xmp>
    			<div class="items">aaa</div>
    		</xmp>
    		
    		.items
    		<xmp>
    			<div class="items"></div>
    		</xmp>
    		
    		.items{bbb}
    		<xmp>
    			<div class="items">bbb</div>
    		</xmp>
    	</li>
    	<li>
    		<h2>4. ์กฐํ•ฉ</h2>		
    		
    		div#box.items
    		<xmp>
    			<div id="box" class="items"></div>
    		</xmp>
    		
    		div#box.items.unit.control
    		<xmp>
    			<div id="box" class="items unit control"></div>
    		</xmp>
    		
    		div#box.items.unit{aaa}
    		<xmp>
    			<div id="box" class="items unit">aaa</div>
    		</xmp>
    		
    		div.items.unit{bbb}
    		<xmp>
    			<div class="items unit">bbb</div>
    		</xmp>
    	</li>
    	<li>
    		<h2>5. ์†์„ฑ ์„ ํƒ์ž</h2>
    		
    		div[title]
    		<xmp>
    			<div title=""></div>
    		</xmp>
    		
    		div[title='test']
    		<xmp>
    			<div title="test"></div>
    		</xmp>
    		
    		a[href='www.naver.com' title='๋„ค์ด๋ฒ„']
    		<xmp><a href="www.naver.com" title="๋„ค์ด๋ฒ„"></a></xmp>
    	
    		a[href='www.naver.com' title='๋„ค์ด๋ฒ„']{์‚ฌ์ดํŠธ๋กœ ์ด๋™}
    		<xmp><a href="www.naver.com" title="๋„ค์ด๋ฒ„">์‚ฌ์ดํŠธ๋กœ ์ด๋™</a></xmp>
    	</li>
    	<li>
    		<h2>6. PCDATA</h2>		
    		
    		div{๋ฐ•์Šค}
    		<xmp>
    			<div>๋ฐ•์Šค</div>
    		</xmp>
    		
    		a{ํ™ˆํŽ˜์ด์ง€๋กœ ์ด๋™}
    		<xmp><a href="">ํ™ˆํŽ˜์ด์ง€๋กœ ์ด๋™</a></xmp>
    		
    		p{๋ฌธ๋‹จ๋‚ด์šฉ๊ธฐ์ˆ }
    		<xmp>
    			<p>๋ฌธ๋‹จ๋‚ด์šฉ๊ธฐ์ˆ </p>
    		</xmp>
    	</li>
    	<li>
    		<h2>๋ฐ˜๋ณต ์ƒ์„ฑ</h2>
    		
    		div*5
    		<xmp>
    			<div></div>
    			<div></div>
    			<div></div>
    			<div></div>
    			<div></div>
    		</xmp>
    		
    		img[src=images/dog.jpg]*5
    		<xmp>
    			<img src="images/dog.jpg" alt="" />
    			<img src="images/dog.jpg" alt="" />
    			<img src="images/dog.jpg" alt="" />
    			<img src="images/dog.jpg" alt="" />
    			<img src="images/dog.jpg" alt="" />
    		</xmp>
    
    		.box*5
    		<xmp>
    			<div class="box"></div>
    			<div class="box"></div>
    			<div class="box"></div>
    			<div class="box"></div>
    			<div class="box"></div>
    		</xmp>
    		
    		.box{content}*5
    		<xmp>
    			<div class="box">content</div>
    			<div class="box">content</div>
    			<div class="box">content</div>
    			<div class="box">content</div>
    			<div class="box">content</div>
    		</xmp>
    		
    		<h3>$ -> ํ•ญ๋ชฉ ๋ฒˆํ˜ธ ๋งค๊ธฐ๊ธฐ</h3>
    		#box$.box{content}*5
    		<xmp>
    			<div id="box1" class="box">content</div>
    			<div id="box2" class="box">content</div>
    			<div id="box3" class="box">content</div>
    			<div id="box4" class="box">content</div>
    			<div id="box5" class="box">content</div>
    		</xmp>
    		
    		img[src=images.obj$.jpg]*5
    		<xmp>
    			<img src="images.obj1.jpg" alt="" />
    			<img src="images.obj2.jpg" alt="" />
    			<img src="images.obj3.jpg" alt="" />
    			<img src="images.obj4.jpg" alt="" />
    			<img src="images.obj5.jpg" alt="" />
    		</xmp>
    		
    		h1*6
    		<xmp>
    			<h1></h1>
    			<h1></h1>
    			<h1></h1>
    			<h1></h1>
    			<h1></h1>
    			<h1></h1>
    		</xmp>
    		
    		h$*6
    		<xmp>
    			<h1></h1>
    			<h2></h2>
    			<h3></h3>
    			<h4></h4>
    			<h5></h5>
    			<h6></h6>
    		</xmp>
    		
    		h${์ œ๋ชฉ$}*6
    		<xmp>
    			<h1>์ œ๋ชฉ1</h1>
    			<h2>์ œ๋ชฉ2</h2>
    			<h3>์ œ๋ชฉ3</h3>
    			<h4>์ œ๋ชฉ4</h4>
    			<h5>์ œ๋ชฉ5</h5>
    			<h6>์ œ๋ชฉ6</h6>
    		</xmp>
    	</li>
    	<li>
    		<h2>8. ์—ฐ์† ์ƒ์„ฑ</h2>
    		
    		div+p
    		<xmp>
    			<div></div>
    			<p></p>
    		</xmp>
    		
    		
    		h1{์ œ๋ชฉ}+p{๋‚ด์šฉ}*5
    		<xmp>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    		</xmp>
    		
    		(h1{์ œ๋ชฉ}+p{๋‚ด์šฉ}*2)*5
    		<xmp>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    			<h1>์ œ๋ชฉ</h1>
    			<p>๋‚ด์šฉ</p>
    			<p>๋‚ด์šฉ</p>
    		</xmp>
    		
    		div+a+div+p+div+img
    		<xmp>
    			<div></div>
    			<a href=""></a>
    			<div></div>
    			<p></p>
    			<div></div>
    			<img src="" alt="" />
    		</xmp>
    	</li>
    	<li>
    		<h2>9. ํ•˜์œ„ ์ƒ์„ฑ</h2>
    		
    		table+	
    		<xmp>
    			<table>
    				<tr>
    					<td></td>
    				</tr>
    			</table>
    		</xmp>
    		
    		ul+
    		<xmp>
    			<ul>
    				<li></li>
    			</ul>
    		</xmp>
    		
    		ol+
    		<xmp>
    			<ol>
    				<li></li>
    			</ol>
    		</xmp>
    		
    		select+	
    		<xmp><select name="" id="">
    				<option value=""></option>
    			</select></xmp>
    	</li>
    	<li>
    		<h2>10. ์ž์‹์ƒ์„ฑ</h2>
    		
    		div>p
    		<xmp>
    			<div>
    				<p></p>
    			</div>
    		</xmp>
    		
    		div>p*5		
    		<xmp>
    			<div>
    				<p></p>
    				<p></p>
    				<p></p>
    				<p></p>
    				<p></p>
    			</div>
    		</xmp>	
    		
    		(div>p*2)*5		
    		<xmp>
    			<div>
    				<p></p>
    				<p></p>
    			</div>
    			<div>
    				<p></p>
    				<p></p>
    			</div>
    			<div>
    				<p></p>
    				<p></p>
    			</div>
    			<div>
    				<p></p>
    				<p></p>
    			</div>
    			<div>
    				<p></p>
    				<p></p>
    			</div>
    		</xmp>		
    		
    		table#tbl>tr*5>td*3		
    		<xmp>
    			<table id="tbl">
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    			</table>
    		</xmp>	
    		
    		table#tbl>tr*3>td.label+td.content		
    		<xmp>
    			<table id="tbl">
    				<tr>
    					<td class="label"></td>
    					<td class="content"></td>
    				</tr>
    				<tr>
    					<td class="label"></td>
    					<td class="content"></td>
    				</tr>
    				<tr>
    					<td class="label"></td>
    					<td class="content"></td>
    				</tr>
    			</table>
    		</xmp>	
    		
    		table#tbl>tr*3>td#label$+td.content
    		<xmp>
    			<table id="tbl">
    				<tr>
    					<td id="label1"></td>
    					<td class="content"></td>
    				</tr>
    				<tr>
    					<td id="label2"></td>
    					<td class="content"></td>
    				</tr>
    				<tr>
    					<td id="label3"></td>
    					<td class="content"></td>
    				</tr>
    			</table>
    		</xmp>
    				
    		table#tbl>(tr>th*3)+((tr>td*3)*5)
    		<xmp>
    			<table id="tbl">
    				<tr>
    					<th></th>
    					<th></th>
    					<th></th>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    			</table>
    		</xmp>
    		
    		
    	</li>
    	<li>
    		<h2>11. ๋”๋ฏธ ํ‚ค์›Œ๋“œ</h2>
    		
    		lorem
    		<xmp>
    		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe quaerat modi totam temporibus voluptas vero exercitationem voluptate alias facilis quis quia deserunt adipisci debitis cumque maiores. Minus aliquam doloribus dolore.
    		</xmp>
    		
    		<h3>lorem์„ ํƒœ๊ทธ์‚ฌ์ด์— ๋„ฃ์œผ๋ฉด ์‹คํ–‰๋˜์ง€ ์•Š์Œ</h3>
    		<p>ใ„ด ๋ฐฉ๋ฒ•1) lorem๋’ค์— ์ปค์„œ๋‘๊ณ  ์‹คํ–‰</p>
    		table>(tr>th*2)+(tr>(td{word}+td{lorem}))*3
    		<xmp>
    			<table>
    				<tr>
    					<th></th>
    					<th></th>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>lorem</td>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>lorem</td>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>lorem</td>
    				</tr>
    			</table>
    		</xmp>
    		
    		<p>ใ„ดlorem์„ ํ•จ์ˆ˜์ฒ˜๋Ÿผ ์‚ฌ์šฉ</p>
    		table>(tr>th*2)+(tr>(td{word}+lorem(td{desc})))*3
    		<xmp>
    			<table>
    				<tr>
    					<th></th>
    					<th></th>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati exercitationem sed enim nam tempora aperiam magni aut. Minus eos beatae odio officia expedita fugit nesciunt molestiae eveniet error amet repellendus.</td>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>Optio dignissimos ipsa distinctio aperiam odit non ut repellendus odio maxime debitis nulla quos quisquam unde aliquam molestias consequatur ipsam perspiciatis consectetur omnis incidunt officiis eum vitae temporibus atque fuga.</td>
    				</tr>
    				<tr>
    					<td>word</td>
    					<td>Exercitationem tenetur voluptatibus non quam earum eveniet omnis soluta quibusdam dolorem sunt facilis esse incidunt inventore corporis nihil repudiandae at itaque quia officia provident tempore ea ad et ex commodi!</td>
    				</tr>
    			</table>
    		</xmp>
    	
    	</li>
    </ul>
    
    </div>
    
    </body>
    </html>

    ใ„ดใ„ดEmmetTest02.html_์‹ค์Šต 1~3

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/main.css"> -->
    <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body>
    	<h2>์‹ค์Šต1</h2>
    	h1#title.blue{Emmet}+(h2.subtitle{์†Œ์ œ๋ชฉ}+p.content{๋‚ด์šฉ})*5
    	<xmp>
    		<h1 id="title" class="blue">Emmet</h1>
    		<h2 class="subtitle">์†Œ์ œ๋ชฉ</h2>
    		<p class="content">๋‚ด์šฉ</p>
    		<h2 class="subtitle">์†Œ์ œ๋ชฉ</h2>
    		<p class="content">๋‚ด์šฉ</p>
    		<h2 class="subtitle">์†Œ์ œ๋ชฉ</h2>
    		<p class="content">๋‚ด์šฉ</p>
    		<h2 class="subtitle">์†Œ์ œ๋ชฉ</h2>
    		<p class="content">๋‚ด์šฉ</p>
    		<h2 class="subtitle">์†Œ์ œ๋ชฉ</h2>
    		<p class="content">๋‚ด์šฉ</p>
    	</xmp>
    	
    	<h2>์‹ค์Šต2</h2>
    	table>(tr.line>(td.col{๋‚ด์šฉ$}+td.comm{๋ถ€์—ฐ์„ค๋ช…})*3)*3
    	table>tr.line*3>((td.col{๋‚ด์šฉ$})*3(td.comm{๋ถ€์—ฐ์„ค๋ช…}))	
    	
    	<table>
    		<tr class="line">
    			<td class="col">๋‚ด์šฉ1</td>
    			<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    		</tr>
    		<tr class="line">
    			<td class="col">๋‚ด์šฉ2</td>
    			<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    		</tr>
    		<tr class="line">
    			<td class="col">๋‚ด์šฉ3</td>
    			<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    		</tr>
    	</table>
    	<xmp>
    		<table>
    			<tr class="line">
    				<td class="col">๋‚ด์šฉ1</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ2</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ3</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    			</tr>
    			<tr class="line">
    				<td class="col">๋‚ด์šฉ1</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ2</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ3</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    			</tr>
    			<tr class="line">
    				<td class="col">๋‚ด์šฉ1</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ2</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    				<td class="col">๋‚ด์šฉ3</td>
    				<td class="comm">๋ถ€์—ฐ์„ค๋ช…</td>
    			</tr>
    		</table>
    	</xmp>
    	
    	<h2>์‹ค์Šต3</h2>
    	table#table>tr#line1*2>th#head${ํ•ญ๋ชฉ$}+td.col{๋‚ด์šฉ$}*3
    	<table id="table">
    		<tr id="line1">
    			<th id="head1">ํ•ญ๋ชฉ1</th>
    			<td class="col">๋‚ด์šฉ1</td>
    			<td class="col">๋‚ด์šฉ2</td>
    			<td class="col">๋‚ด์šฉ3</td>
    		</tr>
    		<tr id="line1">
    			<th id="head2">ํ•ญ๋ชฉ2</th>
    			<td class="col">๋‚ด์šฉ1</td>
    			<td class="col">๋‚ด์šฉ2</td>
    			<td class="col">๋‚ด์šฉ3</td>
    		</tr>
    	</table>
    	
    	
    </body>
    </html>

     

     


    #์ƒ๊ฐํ•ด ๋ณผ ๊ฒƒ

    - ํŒŒ์ด๋„ ํ”„๋กœ์ ํŠธ

    ใ„ด์ฃผ์ œ๊ณ ๋ฏผ

    ใ„ด ์–ด๋–ป๊ฒŒ ๋งŒ๋“ค์ง€ ๊ณ ๋ฏผํ•ด๋ณด๊ธฐ

    ใ„ด ์–ด๋–ค ํŒŒํŠธ๋กœ ๋‚˜๋ˆ ์„œ ํ• ์ง€.. ๋ถ€์กฑํ•œ ๋ถ€๋ถ„ ๊ณต๋ถ€ํ•˜๊ธฐ

    - 2/19๋ถ€ํ„ฐ ํŒŒ์ด๋„ ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ํ•„์ˆ˜