MapleStory Finger Point

๐ŸŸค JAVA/๐ŸŸค JSP 24

[JSP] JDBC (Java Database Connectivity)

[ JDBC ๋ž€? ] Java Database Connectivity์˜ ์•ฝ์ž๋กœ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์—์„œ SQL๋ฌธ์„ ์‹คํ–‰ํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ JAVA API [ ์—ฐ๊ฒฐ API connector ] MYSQL , ORACLE ์— ๋”ฐ๋ผ ์ „์šฉ JDBC ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. [ SQL ์‹คํ–‰ ํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ• ] 1. MyBatis (Spring์—์„œ ํ•™์Šต) 2. ํ•˜์ด๋ฒ„๋„ค์ดํŠธ JPA ๋“ฑ [ ๊ธฐ๋ณธ ์…‹ํŒ… ] ๋”๋ณด๊ธฐ์˜ค๋ผํด hr์Šคํ‚ค๋งˆ ์ดˆ๊ธฐํ™”0. ์ ‘์† ํ•ด์ œ.1. Run sql commandline์ ‘์†=> conn sys as sysdba2. @?/demo/schema/human_resources/hr_main.sql3. HR4. users5. temp6. 12347. C:/oraclexe/app/oracle/product/11.2.0/..

[JSP] JSP Action Tag ์ฃผ์š”ํƒœ๊ทธ

[JSP Action Tag ๋ž€?] JSP ํŽ˜์ด์ง€ ๋‚ด์—์„œ ์–ด๋–ค ๋™์ž‘์„ ํ•˜๋„๋ก ์ง€์‹œํ•˜๋Š” ํƒœ๊ทธ์ด๋‹ค.   [JSP Action Tag ์ข…๋ฅ˜]     [forward]  ์š”์ฒญ ๋ฐ›์€ ์š”์ฒญ๊ฐ์ฒด(request)๋ฅผ ์œ„์ž„ํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ์— ์š”์ฒญ ๊ฐ์ฒด๊ฐ’์„ ๋™์ผํ•˜๊ฒŒ ์ „๋‹ฌ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•จ๊ณผ ๋™์‹œ์— ํ•ด๋‹น ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”๋กœ ๋ณด์—ฌ์ค˜์•ผ ํ•˜๋Š” ๊ฒฝ์šฐex) ๊ฒŒ์‹œํŒ ๋ชฉ๋ก์—์„œ ๊ธ€ ์ œ๋ชฉ์„ ํด๋ฆญํ–ˆ์„ ๋•Œ ๋ฐ”๋กœ ๋‚ด์šฉ์„ ๋ณด์—ฌ์ค˜์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ.[sendRedirect] ์š”์ฒญ ๋ฐ›์€ ์š”์ฒญ๊ฐ์ฒด๋ฅผ(request) ์œ„์ž„ํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ,  ์ƒˆ๋กœ์šด ์š”์ฒญ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•œ ๋‹ค์Œ ์ƒˆ๋กœ์šด ์š”์ฒญ์œผ๋กœ ์ž‘์—…์„ ํ•ด์•ผํ•  ๊ฒฝ์šฐ์— ์‚ฌ์šฉex) ๊ฒŒ์‹œํŒ ๊ธ€ ์“ฐ๊ธฐ ์™„๋ฃŒ ์ดํ›„ ํ•ด๋‹น ๊ธ€์˜ ๋‚ด์šฉ์ด ์•„๋‹Œ ๊ธ€ ๋ชฉ๋ก์„ ๋ณด์—ฌ์ค˜์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ   [forward vs sendRedirect..

[JSP] Java Servlet

[์„œ๋ธ”๋ฆฟ servlet] ์ž๋ฐ” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•  ๋•Œ ์„œ๋ฒ„์ธก์—์„œ ์‹คํ–‰๋˜๋Š” ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์„ ๋œปํ•œ๋‹ค. ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ , ๋™์  ์›น ์ฝ˜ํ…์ธ ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.[์„œ๋ธ”๋ฆฟ servlet ํŠน์ง•]1. ๋™์  ์›น์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ปดํฌ๋„ŒํŠธ (์ˆœ์ˆ˜ ์ž๋ฐ”์ฝ”๋“œ) 2. .java ํ™•์žฅ์ž 3. ํด๋ผ์ด์–ธํŠธ์˜ ์š”์ฒญ์— ๋™์ ์œผ๋กœ ์ž‘๋™ํ•˜๊ณ , ์‘๋‹ต์€ html์„ ์ด์šฉ. 4. java thread๋ฅผ ์ด์šฉํ•˜์—ฌ ๋™์ž‘. 5. MVCํŒจํ„ด์—์„œ Controller๋กœ ์ด์šฉ๋จ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(..

[JSP] JSP : Java Server Pages (๊ฐœ๋…)

[ JSP ๋ž€? ] JavaServer Pages ์˜ ์ค„์ž„๋ง๋กœ ๋™์ ์ธ ์›น ํŽ˜์ด์ง€๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๊ธฐ์ˆ ์ด๋‹ค. ์ž๋ฐ”๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋ฉฐ, HTML ์ฝ”๋“œ์— java ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•˜์—ฌ ๋™์  ์ฝ˜ํ…์ธ ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. [ JSP ํŠน์ง• ] ๋™์  ์›น์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ปดํฌ๋„ŒํŠธ (์ž๋ฐ” ์ฝ”๋“œ ์‚ฌ์šฉ๊ฐ€๋Šฅ) .jsp ํ™•์žฅ์ž jsp๋Š” ์›น์„œ๋ฒ„์™€ ํ†ต์‹ ํ•˜๋ฉด ์ž๋™์œผ๋กœ Servlet ์œผ๋กœ ๋ณ€ํ™˜๋œ๋‹ค. MVC ํŒจํ„ด์—์„œ View ๋กœ ์ด์šฉ๋œ๋‹ค. [ JSP ํƒœ๊ทธ ๊ฐœ๋… ์ดํ•ด ] Servlet ์€ java ์–ธ์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฌธ์„œ๋ฅผ ์ž‘์„ฑํ•จ PrintWriter ์ถœ๋ ฅ ๊ฐ์ฒด๋ฅผ ์ด์šฉํ•ด html ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•จjsp ๋Š” Servlet ๊ณผ ๋ฐ˜๋Œ€๋กœ html ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•˜๊ธฐ์œ„ํ•ด jsp ํƒœ๊ทธ๋ฅผ ์ด์šฉํ•œ๋‹ค.   [JSP ์•„ํ‚คํ…์ณ] .jsp ํŒŒ์ผ์„ ์‹คํ–‰(์š”์ฒญ)ํ•˜๋ฉด ์›น์„œ๋ฒ„(tomc..