๐ ์๋ฐ ์๋ฒ ํ์ด์ง JSP/๐ ์น \ ์๋ธ๋ฆฟ Web , Servlet7 Web - Servlet ์ค์ต 5 (Session ์ด์ฉ ๋ฐฉ๋ฌธ ํ์ ์นด์ดํธ) html hello Servlet world Servlet Servlet โ session ๊ฐ์ฒด ์์ฑํ๊ธฐ session ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ์ request ๋ด์ฅ ๊ฐ์ฒด๋ก๋ถํฐ getSession() ๋ฉ์๋๋ฅผ ์ด์ฉํด์ ๋ค์๊ณผ ๊ฐ์ด ์์ฑํ ์ ์๋ค. HttpSession session = request.getSession(true); getSession() ๋ฉ์๋๋ฅผ ํธ์ถํ๋ฉด ์๋ฒ์์๋ ์ฟ ํค๋ URL๋ก๋ถํฐ ์ธ์ ID๋ฅผ ๋ฝ์๋ด์ ์๋ฒ์ ์ ์ฅ๋์ด ์๋ ์ธ์ ID ๋ชฉ๋ก๊ณผ ๋น๊ต๋ฅผ ํ๊ฒ ๋๋ค. ๊ทธ ๊ฒฐ๊ณผ ์ผ์นํ๋ ์ธ์ ID๊ฐ ์๋ค๋ฉด ํด๋น ์ธ์ ID์ ์ธ์ ๊ฐ์ฒด๋ฅผ ์ ๋ฌํ๊ณ , ์๋ค๋ฉด ์๋ก์ด ์ธ์ ๊ฐ์ฒด๋ฅผ ์์ฑํด์ ์ ๋ฌํด ์ค๋ค. ํ์ง๋ง, ์ธ์ ๊ฐ์ฒด๋ ์๋ JSP์ ๋ด์ฅ ๊ฐ์ฒด๋ก ์ ๊ณต๋๋ค. ๋ฐ๋ผ์ ์์ ๊ฐ์ด ์ง์ ์ ์ธํ์ง ์์๋ ํ.. 2021. 3. 15. Web - Servlet ์ค์ต 4 (form -> ์๋ฒ -> html ์ถ๋ ฅ) HTML index.html method์ ๊ฐ์ผ๋ก๋ ์์ฒญ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์ ( ex> get, post ) Get : http://IP์ฃผ์:port๋ฒํธ/์ปจํ ์คํธ/path/MemberJoin?id="admin"&name="ํ๊ธธ๋" -> doGet() ํธ์ถ [ ๊ฒฝ๋ก๋ ธ์ถ, ๋ณด์ ์ํ ] Post : http://IP์ฃผ์:port๋ฒํธ/์ปจํ ์คํธ/path/MemberJoin -> doPost() ํธ์ถ [header์ ์ ๋ณด๊ฐ ๋ด๊ฒจ์ ์๋ฒ์ ์ ์ก] ์ด๋ฆ 1.form ํ๊ทธ action์ผ๋ก ๋ณด๋ผ ์๋ฒ ๋ช ์นญ์ ์ง์ ํ๋ค. 2.form ํ๊ทธ์์ method๋ฅผ ๊ธฐ์ ํด ์์ฒญ์ฒ๋ฆฌ ๋ฐฉ์์ ์ ํ๋ค. ์ฐ๋ น๋ 10๋~20๋ 20๋~30๋ 30๋~40๋ 40๋~50๋ ์ฑ๋ณ ๋จ์ ์ฌ์ ์ทจ๋ฏธ ํ์ด ๋กค ์นดํํฌ์ด ํ์ธ package way; impo.. 2021. 3. 15. Web - Servlet ์ค์ต 3 (์ํ์ฝ๋ , html ์ฝ๋๋ฅผ ๋ฐ์ ์๋ฒ์์ ํ์ธํ ์ถ๋ ฅ) index.html ์ํ์ฝ๋ ํ์ธ ์ํ์ฝ๋ SC_OK SC_NOT_FOUND SC_INTERNAL_SERVER_ERROR HelloServlet package hello; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class HelloServlet extends HttpServlet { @Override protected void do.. 2021. 3. 14. Web - Servlet ์ค์ต 2 (ํด๋ผ์ด์ธํธ ๋ฐ์ดํฐ -> ์๋ฒ๋ก ๋๊ฒจ์ฃผ๊ธฐ) index.html Servlet xml servlet ๋ฑ๋ก servlet์ ๋๊ฐ๋ก ๋ฑ๋กํ๋ค hello, sample ์๋ ์ฝ๋๋ javaEE๋ก ๋ถ๋ฌ์จ๋ค.(xml)์๋ ์์ฑ ์๋ธ๋ฆฟ์ด๋ฆ๋ช ์ hello๋ก ์ง์ ํด๋์ค๋ hello.HelloServlet ์ด๊ธฐ๋๋ฌธ์ ์๋ฒ์์ ์๋ฐ ํด๋์ค ๋ช ๋ น์ ๋ฐ์์ ์คํ๋๋ค. sample03 index.html index.htm index.jsp default.html default.htm default.jsp hello hello.HelloServlet hello /loc sample sam.SampleServlet sample /sample hello.HelloServlet package hello; import java.io.IOException; import java... 2021. 3. 14. ์ด์ 1 2 ๋ค์