MapleStory Finger Point

โ˜… 567

[Spring / ์‹ค์Šต1] ์ ์ˆ˜ ๋“ฑ๋ก ํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ (DB,VO,Mapper)

1) Oracle database :: TABLE ์ƒ์„ฑ CREATE TABLE SCORE( SNO NUMBER(10), NAME VARCHAR2(30), KOR VARCHAR2(30), ENG VARCHAR2(30), MATH VARCHAR2(30));ALTER TABLE SCORE ADD CONSTRAINT SCORE_SNO_PK PRIMARY KEY (SNO); -- PKCREATE SEQUENCE SCORE_SEQ NOCACHE; --์‹œํ€€์Šค   2) VO ๋งŒ๋“ค๊ธฐ ๋”๋ณด๊ธฐpackage com.simple.basic.command;public class ScoreVO { private int sno; private String name; private String kor; p..

[Spring / ์‹ค์Šต1] ์ ์ˆ˜ ๋“ฑ๋ก ํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ (UI, ํ™”๋ฉด์ œ์ž‘)

1) ์ ์ˆ˜ ๋“ฑ๋ก ํŽ˜์ด์ง€์—์„œ ์ ์ˆ˜๋ฅผ ๋“ฑ๋กํ•˜๋ฉด2) ๋“ฑ๋ก์ด ๋˜์—ˆ๋‹ค๋Š” ๊ฒฐ๊ณผ ํ™”๋ฉด์ด ๋œฌ๋‹ค. 3) ์ดํ›„ ๋ฆฌ์ŠคํŠธ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๋ฉด ๋“ฑ๋กํ•œ ์ ์ˆ˜๋ฅผ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.  1)  UI ์ œ์ž‘ ( jsp ํ™”๋ฉด ๊ตฌ์„ฑํ•˜๊ธฐ ) scoreRegist.jspscoreResult.jspscoreList.jsp  [code] scoreRegist.jsp๋”๋ณด๊ธฐ ์ด๋ฆ„: ๊ตญ์–ด: ์ˆ˜ํ•™: ์˜์–ด:   [code] scoreResult.jsp ๋”๋ณด๊ธฐ ์ ์ˆ˜ ๋“ฑ๋ก์ด ์ •์ƒ์ฒ˜๋ฆฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค! ๋ชฉ๋กํŽ˜์ด์ง€ ์ ์ˆ˜๋“ฑ๋ก   [code] scoreList.jsp ๋”๋ณด๊ธฐ ${a.index } ${vo.name } ${vo.kor } ${vo.eng } ${vo.math } ์‚ญ์ œ ์ถ”๊ฐ€๋“ฑ๋กํ•˜๊ธฐ

[Spring] Persistence Layer ๊ตฌํ˜„ (Data Access)

์˜์† ๊ณ„์ธต(Persistence Layer)์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์•„ํ‚คํ…์ฒ˜์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์˜๊ตฌ์ ์œผ๋กœ ์ €์žฅํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๋Š” ๊ณ„์ธต์„ ์˜๋ฏธ   โ—ˆ  vo ํด๋ž˜์Šค ์ž‘์„ฑํ…Œ์ด๋ธ”์„ ๊ธฐ์ค€์œผ๋กœ vo ํด๋ž˜์Šค๋ฅผ ์ž‘์„ฑํ•ด์ค€๋‹ค.  โ—ˆ  mapper ์ž‘์—… (interface , xml or @ ์ž‘์„ฑ)1) root-context.xml ์—์„œ ํŒจํ‚ค์ง€ ์Šค์บ”์„ ์„ค์ •ํ•ด์ค˜์•ผํ•œ๋‹ค. 2) xml ๋กœ ๊ตฌํ˜„ํ• ๊ฑด์ง€ @ ๋กœ ๊ตฌํ˜„ํ• ๊ฑด์ง€ ์„ ํƒํ•œ๋‹ค๊ฐ„๋‹จํ•œ sql ์€ @ ์ถ”์ฒœ   โ—ˆ  test ํด๋ž˜์Šค๋กœ DB ์ž‘๋™ ํ…Œ์ŠคํŠธ1) @Autowired ๋ฅผ ํ†ตํ•ด์„œ Mapper ์ธํ„ฐํŽ˜์ด์…˜์˜ ๊ตฌํ˜„์ฒด๋ฅผ ์ฃผ์ž…์‹œํ‚จ๋‹ค.2) SQL develop ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ or ๊ฒฐ๊ณผ ๊ฐ’ ์ฒดํ‚น  โ—ˆ xml or @ ์–ด๋…ธํ…Œ์ด์…˜ ์ž‘์„ฑ1) xml SELECT * FROM users WHERE..

[Spring] Spring JDBC ์™€ Mybatis

โ—ˆ JDBC connection ์ง์ ‘ ์ฒ˜๋ฆฌpropareStatement ์ƒ์„ฑ ์ฒ˜๋ฆฌsql ์ž‘์„ฑresultSet (select ๋ฌธ) ์ฒ˜๋ฆฌclose() ๋ฆฌ์†Œ์Šคํ•ด์ œ โ—ˆ Spring JDBC Connection Pool DataSource  (์ธํ„ฐํŽ˜์ด์Šค์ž„)  ๋กœ ์ปค๋„ฅ์…˜ ํ’€์„ ์‚ฌ์šฉํ•œ๋‹ค.   ์ปค๋„ฅ์…˜ ํ’€์€ ์—ฌ๋Ÿฌ ์ข…๋ฅ˜๊ฐ€ ์žˆ๋‹ค.์ตœ๊ทผ ์œ ํ–‰ํ•˜๋Š” ๊ฑด   (Hikari cp ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ) (Spring jdbc + Connection ) ๐Ÿ”Œpom.xml ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€  --- Hikari cp       โ—ˆ Mybatis  sql ๋งคํ•‘ ํ”„๋ ˆ์ž„์›Œํฌ mybatis-spirng ์ด๋ผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ†ตํ•ด ์‰ฝ๊ฒŒ ์—ฐ๋™ ์ž‘์—… ๊ฐ€๋Šฅ   ๐ŸคคํŠน์ง• 1(DAO ๋Œ€์‹ ์— Mapper ์‚ฌ์šฉ)(java ์ฝ”๋“œ ๋Œ€์‹  xml ์‚ฌ์šฉ) ๐Ÿคค ํŠน์ง•2 :: ์ž๋™..

[JSP] JDBC statement, prepareStatement (SQL ์ธ์ ์…˜)

SQL ์ฟผ๋ฆฌ ์‹คํ–‰ ๋ฐฉ์‹Statement:์ผ๋ฐ˜์ ์ธ SQL ์ฟผ๋ฆฌ๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.SQL ์ฟผ๋ฆฌ๋Š” ์‹คํ–‰ํ•  ๋•Œ๋งˆ๋‹ค ์ƒˆ๋กญ๊ฒŒ ๊ตฌ๋ฌธ ๋ถ„์„๋˜๊ณ  ์ปดํŒŒ์ผ๋ฉ๋‹ˆ๋‹ค.์ฟผ๋ฆฌ ๋‚ด์— ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ง์ ‘ SQL ๋ฌธ์— ๊ฐ’์„ ์‚ฝ์ž…ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.SQL ์ธ์ ์…˜ ๊ณต๊ฒฉ์— ์ทจ์•ฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Statement stmt = connection.createStatement(); String sql = "SELECT * FROM users WHERE id = " + userId; ResultSet rs = stmt.executeQuery(sql);PreparedStatement:๋ฏธ๋ฆฌ ์ปดํŒŒ์ผ๋œ SQL ๋ฌธ์„ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ?๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๋‚˜์ค‘์— ๊ฐ’์„ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.๋™์ผํ•œ ..

[JSP] ํŽ˜์ด์ง• ์ด๋ž€?

1. ๋ฐ˜๋“œ์‹œGET ๋ฐฉ์‹์œผ๋กœ๋งŒ์ฒ˜๋ฆฌํ•œ๋‹ค2. ์ด๋™ํ• ๋•ŒํŽ˜์ด์ง€๋ฒˆํ˜ธ, ๋ณด์—ฌ์ค„ํŽ˜์ด์ง€๊ฐœ์ˆ˜๋ฅผ๊ฐ€์ง€๊ณ ๋‹ค๋…€์•ผํ•œ๋‹ค-> ๋ชฉ๋ก ์œผ๋กœ ๋‚˜์˜ฌ๋•Œํ˜„์žฌํŽ˜์ด์ง€๋ฅผ์œ ์ง€ํ•˜๊ธฐ์œ„ํ•ด3. ํŽ˜์ด์ง• ์ฒ˜๋ฆฌํ•˜๋Š”๋กœ์ง์„ํด๋ž˜์Šค๋กœ๋ถ„๋ฅ˜ํ•œ๋‹ค-> PageVOํด๋ž˜์Šค๋Š” ํŽ˜์—์ง• ๊ด€๋ จ ๋ชจ๋“  ํŽ˜์ด์ง€๋ฅผ ๊ณ„์‚ฐํ•œ๋‹ค