๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๊ฐœ๋ฐœ์ž90

JSP - 2. ์„ค๋ฌธ์ง€ ์ž‘์„ฑํ•˜์—ฌ JSP ํŽ˜์ด์ง€๋กœ ๋ฐ์ดํ„ฐ ๋„˜๊ธฐ๊ธฐ 1. sumbit ์œผ๋กœ jspํŽ˜์ด์ง€์—์„œ ๋ฐ”๋กœ ์ถœ๋ ฅ insert.jsp ์•„์ด๋””: ํŒจ์Šค์›Œ๋“œ: ์ทจ๋ฏธ ์ž ์ž๊ธฐ ๋…ธ๋ž˜ํ•˜๊ธฐ ๊ฒŒ์ž„ํ•˜๊ธฐ ์—ฐ๋ น๋Œ€ 10๋Œ€ 20๋Œ€ 30๋Œ€ 40๋Œ€ 50๋Œ€ 60๋Œ€์ด์ƒ ๊ธฐํƒ€ํ•˜๊ณ ์‹ถ์€๋ง insertAf.jsp ์ „์†ก๋œ ์ •๋ณด ์•„์ด๋””: ํŒจ์Šค์›Œ๋“œ: 2021. 3. 15.
JSP - 1. ๋‚ด์žฅ๊ฐ์ฒด (Parameter) ๋กœ ๋ฐ์ดํ„ฐ ๋ฐ›์•„ ์ „์†ก request.setCharacterEncoding("utf-8"); ์ธ์ฝ”๋”ฉ์„ค์ • ๋‚ด์žฅ๊ฐ์ฒด 4๊ฐ€์ง€ request getParameter -๊ฐ’์„ ๋ฐ›์„ ๋•Œ getParameterValues -๊ฐ’๋“ค์„ ๋ฐ›์„ ๋Œ€ setAttribute -์ง์Œ€๋•Œ(๊ฐ์ฒด๋ฅผ ์ €์žฅํ•œ๋‹ค) getAttribute -์งํ’€์–ด YouClass cls = new YouClass("์ฃผ์ง€ํ›ˆ"); //์ง์‹ธ! //๋‚ด์žฅ๊ฐ์ฒด //1 ๋ฒˆ์งธ request.setAttribute("you", cls); Object obj = request.getAttribute("you"); //Object obj = session.getAttribute("you"); YouClass ycls = null; if(obj != null){ ycls = (YouClass)obj; } .. 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.