๋กœ์ผ“๐Ÿพ
article thumbnail
[Oracle] ์กฐํšŒ ์ˆœ๋ฒˆ ๋งค๊ธฐ๊ธฐ ROW_NUMBER()
... 2021. 1. 26. 10:11

์˜ค๋ผํด์—์„œ ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ ๋“ฑ์„ ํ• ๋•Œ ๋กœ์šฐ์˜ ์ˆœ๋ฒˆ์„ ๋งค๊ธด ๋’ค ์ •๋ ฌ์„ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋•Œ ROW_NUMBER() ์„ ์‚ฌ์šฉํ•˜๋ฉด ์‰ฝ๊ฒŒ ์ˆœ๋ฒˆ์„ ๋งค๊ธธ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. # ์˜ˆ์ œ ์ฝ”๋“œ ์˜ˆ์ œ ํ…Œ์ด๋ธ”์—์„œ ๋‹จ์ˆœ SELECT ์ฟผ๋ฆฌ๋ฌธํ–ˆ์„ ๋•Œ ์œ„์™€ ๊ฐ™์€ ๋กœ์šฐ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ € ํ…Œ์ด๋ธ”์˜ ๋กœ์šฐ๋ฅผ ๋‚ ์งœ(REGIST_DT)๋กœ ์ •๋ ฌํ•˜๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค. ORDER BY๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ •๋ ฌ ํ•  ์ˆ˜ ์žˆ๊ฒ ์ง€๋งŒ ์ด๋ ‡๊ฒŒ๋งŒ ํ•˜๋ฉด ๋ถ„๋ช… ํ•œ๊ณ„๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์•ผํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ด…์‹œ๋‹ค. 1, 2, .. ํŽ˜์ด์ง€ ๋“ฑ์ด ์กด์žฌํ•  ๊ฒƒ์ด๊ณ , ํ•œ ํŽ˜์ด์ง€์—๋Š” 10๊ฐœ์˜ ๋กœ์šฐ๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ  ๋กœ์šฐ๋Š” ๋‚ ์งœ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ทฐ์— ๋ฟŒ๋ ค์ง„๋‹ค๊ณ  ํ•ฉ์‹œ๋‹ค. ๋งŒ์•ฝ ORDER BY๋งŒ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด 1ํŽ˜์ด์ง€์—๋Š” ๋ฌธ์ œ ์—†์ด ๋กœ์šฐ๊ฐ’์„ ๋ฟŒ๋ฆด์ˆ˜ ์žˆ๊ฒ ์ง€๋งŒ, ๋ฌธ์ œ๋Š” 2ํŽ˜์ด์ง€๋ถ€ํ„ฐ ์ž…๋‹ˆ๋‹ค. 2ํŽ˜์ด์ง€์—์„œ 11๋ฒˆ์งธ๋ถ€..

article thumbnail
[CA] ๋™๊ธฐ(Blocking)์™€ ๋น„๋™๊ธฐ(Non-Blocking)
... 2021. 1. 24. 13:30

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

article thumbnail
[JS] ์ •๊ทœ์‹ ์˜ˆ์ œ๋“ค
... 2021. 1. 21. 14:03

๋ชจ๋“  ๊ณต๋ฐฑ ์ฒดํฌ ์ •๊ทœ์‹ var regExp = /\s/g; ์ˆซ์ž๋งŒ ์ฒดํฌ ์ •๊ทœ์‹ var regExp = /^[0-9]+$/; ์ด๋ฉ”์ผ ์ฒดํฌ ์ •๊ทœ์‹ var regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i; ํ•ธ๋“œํฐ๋ฒˆํ˜ธ ์ •๊ทœ์‹ var regExp = /^\d{3}-\d{3,4}-\d{4}$/; ์ผ๋ฐ˜ ์ „ํ™”๋ฒˆํ˜ธ ์ •๊ทœ์‹ var regExp = /^\d{2,3}-\d{3,4}-\d{4}$/; ์•„์ด๋””๋‚˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ •๊ทœ์‹ var regExp = /^[a-z0-9_]{4,20}$/; ํœด๋Œ€ํฐ๋ฒˆํ˜ธ ์ฒดํฌ ์ •๊ทœ์‹ var regExp = /^01([0|1|6|7|8|9]?)-?([0-9]{3,4})-?([0-9]{4..

article thumbnail
[JS] ์ œ์ด์ฟผ๋ฆฌ id, class, name ์†์„ฑ ๊ฐ’ ๊ฐ€์ ธ์˜ค๊ธฐ
... 2021. 1. 21. 14:03

input์˜ value ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค. $('#testID').val(); // id ์„ ํƒ์ž๊ฐ€ ๊ธฐ์ค€์ผ ๋• #์„ ๋ถ™์—ฌ์ค๋‹ˆ๋‹ค. $('.testClass').val(); // class ์„ ํƒ์ž๊ฐ€ ๊ธฐ์ค€์ผ ๋• .์„ ๋ถ™์—ฌ์ค๋‹ˆ๋‹ค. $('[name=testName]').val(); // id, class ์™ธ์—” ์ด๋Ÿฐ์‹์œผ๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. $('[test=testName]').val(); // ๋งŒ์•ฝ test ๊ฒฐ๊ณผ๊ฐ’์„ ์ž˜ ๊ฐ€์ ธ์˜จ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

article thumbnail
[Js] ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํ•œ๊ธ€, ์˜์–ด, ์ˆซ์ž ์ฒดํฌํ•˜๊ธฐ
... 2021. 1. 21. 12:28

์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•œ๊ธ€, ์˜์–ด, ์ˆซ์ž ์ฒดํฌ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. # ์˜ˆ์‹œ var pattern1 = /[0-9]/; //์ˆซ์ž var pattern2 = /[a-zA-Z]/; //์˜์–ด var pattern3 = /[ใ„ฑ-ใ…Ž|ใ…-ใ…ฃ|๊ฐ€-ํžฃ]/; //ํ•œ๊ธ€ var pattern4 = /[~!@#\#$%^&*]/; //ํŠน์ˆ˜๋ฌธ์ž var testStr = "ํ…Œ์ŠคํŠธtest"; //์ˆซ์ž ์ฒดํฌํ•˜๊ณ  ์‹ถ์„ ๋•Œ if (pattern1.test(testStr)) { alert("์ˆซ์ž๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค."); //false } //์˜์–ด ์ฒดํฌํ•˜๊ณ  ์‹ถ์„ ๋•Œ if(pattern2.test(testStr)){ alert("์˜์–ด๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค."); //true } //ํ•œ๊ธ€ ์ฒดํฌํ•˜๊ณ  ์‹ถ์„ ๋•Œ if(pattern3.test(testStr)){ alert..

article thumbnail
[Spring] ApplicationContext์™€ WebApplicationContext
... 2021. 1. 20. 23:26

์ด ๊ธ€์€ ์ œ๊ฐ€ ์ดํ•ดํ•œ ๊ฐœ๋…์„ ๋ฐ”ํƒ•์œผ๋กœ ์ž‘์„ฑํ•˜์˜€๊ธฐ์— ํ‹€๋ฆฐ ๋ถ€๋ถ„์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ‹€๋ฆฐ ๋ถ€๋ถ„ ์žˆ๋‹ค๋ฉด ์ง€์ ํ•ด์ฃผ์„ธ์š” :) ์Šคํ”„๋ง์—์„œ ๋งํ•˜๋Š” ์ปจํ…์ŠคํŠธ(context)๋Š” ์Šคํ”„๋ง์ด ๊ด€๋ฆฌํ•˜๋Š” ๋นˆ๋“ค์ด ๋‹ด๊ฒจ ์žˆ๋Š” ์ปจํ…Œ์ด๋„ˆ ๋ผ๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์Šคํ”„๋ง์„ ๊ณ„์† ๊ณต๋ถ€์ค‘์ด์ง€๋งŒ ์—„์ฒญ ํ—ท๊ฐˆ๋ ธ๋˜ ๋ถ€๋ถ„์ด WebApplicationContext์™€ ApplicationContext์˜ ๊ด€๊ณ„, web.xml์—์„œ์˜ servlet-context์™€ root-context์˜ ๊ด€๊ณ„ ๊ทธ๋ฆฌ๊ณ  ContextLoaderListenter์™€ dispatcher-servlet์˜ ๊ด€๊ณ„ ์ด ์ด 3๊ฐœ์˜ ๊ด€๊ณ„๊ฐ€ ๋ณผ๋•Œ๋งˆ๋‹ค ํ—ท๊ฐˆ๋ ธ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ด ๊ด€๊ณ„๋“ค์„ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ทธ๋ฆผํ™”ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. # web.xml์—์„œ์˜ Context contextConfigLocation c..

article thumbnail
[Spring] root-context์™€ servlet-context
... 2021. 1. 20. 23:03

์ด ๊ธ€์€ ์ œ๊ฐ€ ์ดํ•ดํ•œ ๊ฐœ๋…์„ ๋ฐ”ํƒ•์œผ๋กœ ์ž‘์„ฑํ•˜์˜€๊ธฐ์— ํ‹€๋ฆฐ ๋ถ€๋ถ„์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ‹€๋ฆฐ ๋ถ€๋ถ„ ์žˆ๋‹ค๋ฉด ์ง€์ ํ•ด์ฃผ์„ธ์š” :) ์Šคํ”„๋ง์—์„œ ๋งํ•˜๋Š” ์ปจํ…์ŠคํŠธ(context)๋Š” ์Šคํ”„๋ง์ด ๊ด€๋ฆฌํ•˜๋Š” ๋นˆ๋“ค์ด ๋‹ด๊ฒจ ์žˆ๋Š” ์ปจํ…Œ์ด๋„ˆ ๋ผ๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์Šคํ”„๋ง์„ ๊ณ„์† ๊ณต๋ถ€์ค‘์ด์ง€๋งŒ ์—„์ฒญ ํ—ท๊ฐˆ๋ ธ๋˜ ๋ถ€๋ถ„์ด WebApplicationContext์™€ ApplicationContext์˜ ๊ด€๊ณ„, web.xml์—์„œ์˜ servlet-context์™€ root-context์˜ ๊ด€๊ณ„ ๊ทธ๋ฆฌ๊ณ  ContextLoaderListenter์™€ dispatcher-servlet์˜ ๊ด€๊ณ„ ์ด ์ด 3๊ฐœ์˜ ๊ด€๊ณ„๊ฐ€ ๋ณผ๋•Œ๋งˆ๋‹ค ํ—ท๊ฐˆ๋ ธ์Šต๋‹ˆ๋‹ค. # root-context ์™€ sevlet-context ํ๋ฆ„ ์ด ๊ธ€์€ WAC์™€ AC ๊ด€๋ จ ๊ธ€์ด ์•„๋‹ˆ๋ฏ€๋กœ root-context์™€ ..

article thumbnail
[tomcat] Not allowed to load local resource ์—๋Ÿฌ
... 2021. 1. 20. 19:04

# ์›์ธ ํ”„๋กœ์ ํŠธ ์™ธ๋ถ€์— ์กด์žฌํ•˜๋Š” ํŒŒ์ผ ์—…๋กœ๋“œ์˜ ๊ฒฝ์šฐ ๋ณด์•ˆ์ƒ์˜ ์ด์œ ๋กœ ์ด๋ฏธ์ง€์— ์ ‘๊ทผํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰ ์›น์—์„œ ๋กœ์ปฌํด๋”๋กœ ์ ‘๊ทผ์ด ๋ถˆ๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. # ํ•ด๊ฒฐ tomcat์˜ server.xml ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. docBase="D:/FileUpload/kssfbiz/" ์ด๋ ‡๊ฒŒ ์„ค์ •ํ•ด์ฃผ์‹œ๋ฉด url๋กœ ๋“ค์–ด๊ฐˆ ๋•Œ๋Š” localhost:8080/kssfbiz/upload ์ด๋Ÿฐ์‹์œผ๋กœ ๋“ค์–ด๊ฐ€์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋ฌผ๋ฆฌ์  ์ฃผ์†Œ - D:/FileUpload/kssfbiz/ ๋…ผ๋ฆฌ์  ์ฃผ์†Œ(์‹ค์ œ ์ ‘์†ํ•  ๋•Œ) - http://localhost:8080/kssfbiz/upload/ (๋กœ์ปฌ์ผ์‹œ) ์ฃผ์˜ํ• ์ ์€ ๋ฐ˜๋“œ์‹œ reloadable์„ true๋กœ ํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. "๋‚œ ๋ฐ˜๋“œ์‹œ ๋ฐฑ์—”..

article thumbnail
[Spring] @RestController ๋ž€?
... 2021. 1. 18. 23:20

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” @RestController๋ผ๋Š” ์–ด๋…ธํ…Œ์ด์…˜์— ๋Œ€ํ•ด ์•Œ์•„ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. @RestController๋Š” ์ปจํŠธ๋กค๋Ÿฌ์—์„œ ๋ธŒ๋ผ์šฐ์ €๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ผ ๋•Œ ์ด๋ฅผ ์ฒ˜๋ฆฌํ•ด์„œ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธํ˜• ๋ฐ์ดํ„ฐ, VO ๊ฐ์ฒด์˜ ์†์„ฑ ๊ฐ’, Map์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ ๋“ฑ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค. ์šฐ์„  @RestController๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์Šคํ”„๋ง 4.0์ด์ƒ์ด์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ 3.x ๋ฒ„์ „์„ ์ด์šฉํ•œ๋‹ค๋ฉด pom.xml์—์„œ 1.6 4.1.1.RELEASE 1.6.10 1.6.6 4.*.* ๋ฒ„์ „์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  JOSN ํ˜•์‹์œผ๋กœ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•œ JSON ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. com.fasterxml.jackson.core jackson-databind 2.5.4 # VO ๊ฐ์ฒด ์ „๋‹ฌํ•˜..

article thumbnail
Current request is not of type [org.springframework.web.multipart.MultipartHttpServletRequest] ์—๋Ÿฌ
... 2021. 1. 18. 22:20

# ์›์ธ java.lang.IllegalStateException: Current request is not of type [org.springframework.web.multipart.MultipartHttpServletRequest]: org.apache.catalina.connector.RequestFacade@6b6f9564 at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.resolveStandardArgument(AnnotationMethodHandlerAdapter.java:826) at org.springframework.web.bind.annot..

article thumbnail
[Js] ajax ํŒŒ์ผ ์—…๋กœ๋“œํ•˜๊ธฐ
... 2021. 1. 18. 19:56

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ajax๋ฅผ ์ด์šฉํ•˜์—ฌ ํŒŒ์ผ์„ ์„œ๋ฒ„์— ์—…๋กœ๋“œ ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ajax๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ๊ตณ์ด ํŒŒ์ผ ์ „์†ก์„ ์œ„ํ•˜์—ฌ form ํƒœ๊ทธ๋กœ ๊ฐ์‹ธ์ค„ ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์€ ์Šคํ”„๋ง ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. # Front ์ œ์ถœํ•˜๊ธฐ ajax์˜ ์†์„ฑ ๋‚˜๋จธ์ง€๋Š” ์•Œ๊ฑฐ๋ผ ์ƒ๊ฐํ•˜๊ณ  processData๋งŒ ์งš๊ณ  ๋„˜์–ด๊ฐ€๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. processData๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์„œ๋ฒ„์— ์ „๋‹ฌ๋˜๋Š” ๋ฐ์ดํ„ฐ๋Š” query string ์ด๋ผ๋Š” ํ˜•ํƒœ๋กœ ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค. http://example.com/over/there?title=Main_page&action=raw ? ๋’ค์— ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์ด ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค. ์ฃผ์˜ํ•  ์ ์€ ํŒŒ์ผ ์ „์†ก์ด ์žˆ์„ ๊ฒฝ์šฐ ์ด๋ฅผ ๋ฐ˜๋“œ์‹œ false๋กœ ํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. # Back @Controller("mainControl..

article thumbnail
[Spring] Dispatcher-Servlet์ด๋ž€?
... 2021. 1. 17. 14:54

Sevlet Container, Servlet์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์•˜๊ณ  ์ด๋ฒˆ์—” Servlet์˜ ๋Œ€ํ‘œ๊ฒฉ์„ ๋งก๊ณ  ์žˆ๋Š” Dispatcher-Servlet์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. # Dispatcher-Servlet์˜ ์ •์˜ ์Šคํ”„๋ง์—์„œ ์ •์˜ํ•œ ๊ฐœ๋…์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค. Servlet Container์—์„œ HTTPํ”„๋กœํ† ์ฝœ์„ ํ†ตํ•ด ๋“ค์–ด์˜ค๋Š” ๋ชจ๋“  ์š”์ฒญ์„ ํ”„๋ ˆ์  ํ…Œ์ด์…˜ ๊ณ„์ธต์˜ ์ œ์ผ์•ž์— ๋‘ฌ์„œ ์ค‘์•™์ง‘์ค‘์‹์œผ๋กœ ์ฒ˜๋ฆฌํ•ด์ฃผ๋Š” ํ”„๋ก ํŠธ ์ปจํŠธ๋กค๋Ÿฌ(Front Controller) ์ข€ ๋” ์‰ฝ๊ฒŒ ์„ค๋ช…ํ•˜์ž๋ฉด, ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์š”์ฒญ์„ ๋ณด๋‚ด์˜ค๋ฉด ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์š”์ฒญ์„ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด๋•Œ ์ œ์ผ ์•ž์—์„œ ์„œ๋ฒ„๋กœ ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ํ”„๋ก ํŠธ ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์žˆ๋Š”๋ฐ ์ด๋ฅผ Dipatcher Servlet์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. # Dispatcher-Servlet์˜ ํ..

article thumbnail
[Spring] ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ๋ž€?
... 2021. 1. 17. 14:20

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

article thumbnail
[Spring] ์Šคํ”„๋ง์—์„œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 14. 22:26

์Šคํ”„๋ง์—์„œ DB ์ •๋ณด๋ฅผ ๊ฐ™์€ ์ •๋ณด๋ฅผ ์ˆจ๊ธฐ๊ธฐ ์œ„ํ•ด ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ๊นƒํ—™์— ํ”„๋กœ์ ํŠธ๋ฅผ ์˜ฌ๋ฆด ๋•Œ DB์ •๋ณด๊ฐ€ ์žˆ๋Š” properties ํŒŒ์ผ๋งŒ gitignore๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปค๋ฐ‹์•ˆ๋˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. properties ํŒŒ์ผ์˜ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค. /WEB-INF/config/jdbc.properties PropertyPlaceholderConfigurer ํด๋ž˜์Šค์˜ ์†์„ฑ์„ ์ด์šฉํ•˜์—ฌ properties์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ""์•ˆ์— ์“ฐ์‹ค ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค. ์œ„์™€ ๊ฐ™์ด xml ํŒŒ์ผ์—์„œ ๋ฐ›์„์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

article thumbnail
[Spring] ์Šคํ”„๋ง servlet-context๋กœ jsp ๊ฒฝ๋กœ ์„ค์ •ํ•˜๊ธฐ
... 2021. 1. 14. 22:17

์Šคํ”„๋ง์—์„œ ๋นˆ์„ ์ด์šฉํ•œ jsp ๊ฒฝ๋กœ ์„ค์ • ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. bean์„ ์ด์šฉํ•˜์—ฌ viewResolver ํด๋ž˜์Šค์˜ ์†์„ฑ์„ ์œ„์™€ ๊ฐ™์ด ์„ค์ •ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ModelAndView mav = new ModelAndView("home"); views๋กœ ๊ธฐ์ค€์œผ๋กœ ์ƒ๋Œ€๊ฒฝ๋กœ๋ฅผ ์ ์–ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ views/list/home.jsp ๋ผ๋ฉด view์˜ ๊ฒฝ๋กœ๋Š” /list/home์ž…๋‹ˆ๋‹ค. ๋’ค์— jsp๋ฅผ ๋ถ™์ด์‹œ๋ฉด ์•ˆ๋ฉ๋‹ˆ๋‹ค.

article thumbnail
[Spring] log4j ์ด์šฉํ•˜์—ฌ ๋กœ๊ทธ ์ถœ๋ ฅํ•˜๊ธฐ
... 2021. 1. 14. 22:11

์ž๋ฐ”๋ฅผ ํ•˜๊ฒŒ๋˜๋ฉด ์ฝ˜์†”์— ๋ฐ์ดํ„ฐ๋ฅผ ์ถœ๋ ฅํ•˜๊ธฐ ์œ„ํ•ด System.out.println()์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์Šคํ”„๋ง์—์„œ๋Š” ์ด๋ฅผ ์‚ฌ์šฉํ•  ํ•„์š”์—†์ด log4j๋ผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ๋กœ๊ทธ ๊ด€๋ จํ•œ ๊ธฐ๋Šฅ๋“ค์„ ๊ด€๋ฆฌํ•ด์ค๋‹ˆ๋‹ค. ์ด ๊ธ€์€ STS(Spring toos Suite)๋กœ ์ƒ์„ฑํ•œ ์Šคํ”„๋ง ํ”„๋กœ์ ํŠธ ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. STS๋ฅผ ์ด์šฉํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๊ฐ€์žฅ ํ•˜๋‹จ์— ๊ด€๋ จ ๊ธ€์„ ํฌ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ธ€์€ ์ž๋ฐ”์›น์„ ๋‹ค๋ฃจ๋Š” ๊ธฐ์ˆ  ์ฑ…์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค. log4j๋ž€? ์Šคํ”„๋ง์œผ๋กœ ๊ฐœ๋ฐœํ• ๋•Œ ๋ณด๋ฉด ์ฝ˜์†”์— ์œ„์™€ ๊ฐ™์€ ์—„์ฒญ ๋งŽ์€ ๋กœ๊ทธ๋“ค์ด ์ถœ๋ ฅ๋˜๋Š”๋ฐ ์ด ๋ชจ๋“ ๊ฒŒ log4j ๋•๋ถ„์ž…๋‹ˆ๋‹ค. ๊ฐœ๋ฐœํ•  ๋‹น์‹œ์— ์‚ฌ์šฉํ–ˆ๋˜ ๋กœ๊ทธ ๋ฉ”์‹œ์ง€๋“ค์€ ์‹ค์ œ๋กœ ์„œ๋น„์Šคํ•  ๋•Œ ์ „ํ˜€ ํ•„์š”์—†๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿด ๊ฒฝ์šฐ ์ผ์ผ์ด ์ฐพ์•„์„œ ํ•ด๋‹น ๋กœ๊ทธ๋“ค์„ ์‚ญ์ œํ•ด์ฃผ์–ด์•ผ ํ•˜๋Š”๋ฐ ์ด๋Š”..

article thumbnail
[Js] window.open ํ•จ์ˆ˜๋กœ ํŒ์—…์ฐฝ ์—ด๊ธฐ
... 2021. 1. 14. 11:37

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ด์šฉํ•˜์—ฌ ํŒ์—… ์ฐฝ์„ ์—ฌ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. l window.open() ํ•จ์ˆ˜ window.open() ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์‰ฝ๊ฒŒ ํŒ์—…์ฐฝ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. window.open("ํŒ์—…์ฐฝ์œผ๋กœ ์‚ฌ์šฉํ•  ํŒŒ์ผ(๊ฒฝ๋กœํฌํ•จ) ๋˜๋Š” uri","์ง€์ •ํ•  ํŒ์—…์˜ ์ด๋ฆ„","ํฌ๊ธฐ์™€ ์œ„์น˜"); l ์˜ˆ์‹œ window.open("test.html","ํŒ์—… ํ…Œ์ŠคํŠธ","width=400, height=300, top=10, left=10"); popup.html๋ฅผ ์œ„์™€ ๊ฐ™์ด ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ํŒ์—…์ฐฝ ํ˜ธ์ถœํ•  ํŒ์—…์ฐฝ์˜ html์ž…๋‹ˆ๋‹ค. ์„ธ๋ฒˆ์งธ ์ธ์ž๋ฅผ ์กฐ์ •ํ•˜์—ฌ ํŒ์—…์˜ ํฌ๊ธฐ ๋˜ํ•œ ์กฐ์ ˆ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. "๋‚œ ๋ฐ˜๋“œ์‹œ ๋ฐฑ์—”๋“œ ์™•์ด ๋ ๊ฑฐ์•ผ"

article thumbnail
List cannot be resolved to a type ์—๋Ÿฌ
... 2021. 1. 12. 12:11

l ์›์ธ jsp์— List ๊ด€๋ จ ํด๋ž˜์Šค๊ฐ€ ์—†์–ด์„œ ์—๋Ÿฌ๊ฐ€ ๋‚ฉ๋‹ˆ๋‹ค. l ํ•ด๊ฒฐ ๋”ฐ๋ผ์„œ jsp์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด import ์‹œ์ผœ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

article thumbnail
Tomcat 8 / ์š”์ฒญ ํƒ€๊ฒŸ์—์„œ ์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฌธ์ž๊ฐ€ ๋ฐœ๊ฒฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. tomcat rfc 7230 rfc 3986 ์˜ค๋ฅ˜
... 2021. 1. 12. 10:45

l ์›์ธ http://localhost:8080/adm/main_visual?mode=insert&orderKey=regist_dt&startPage=-1&orderVal=desc&searchKey[]=use_yn ํ†ฐ์บฃ์—์„œ ๋‚˜๋Š” ์˜ค๋ฅ˜๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์— [] ๊ฐ™์€ ํŠน์ˆ˜๋ฌธ์ž๊ฐ€ ์žˆ์–ด์„œ ๋‚˜๋Š” ์—๋Ÿฌ์ž…๋‹ˆ๋‹ค. l ํ•ด๊ฒฐ server.xml์—์„œ relaxedQueryChars="[,]" ์„ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ํ•ด๊ฒฐ ์™„๋ฃŒ!

article thumbnail
[Spring] ๋ฉ”์ด๋ธ๊ณผ STS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํ”„๋ง ํ™˜๊ฒฝ ๊ตฌ์ถ•
... 2021. 1. 11. 22:41

๋ฉ”์ด๋ธ์€ ์˜คํ”ˆ ์†Œ์Šค ๋นŒ๋“œ ํˆด์ž…๋‹ˆ๋‹ค. ๋ฉ”์ด๋ธ์„ ์‚ฌ์šฉํ•˜๋ฉด ํ”„๋กœ์ ํŠธ ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ๊ทธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์˜์กดํ•˜๋Š” Dependency ์ž์›๊นŒ์ง€ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฉ”์ด๋ธ์€ ํ”„๋กœ์ ํŠธ ์ „๋ฐ˜์˜ ๋ฆฌ์†Œ์Šค ๊ด€๋ฆฌ์™€ ์„ค์ • ํŒŒ์ผ ๊ทธ๋ฆฌ๊ณ  ์ด์™€ ๊ด€๋ จ๋œ ํ‘œ์ค€ ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ตฌ์กฐ๋ฅผ ์ฒ˜์Œ๋ถ€ํ„ฐ ์ผ๊ด€๋œ ํ˜•ํƒœ๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค. l ๋ฉ”์ด๋ธ(Maven) ์„ค์น˜ํ•˜๊ธฐ maven.apache.org/download.cgi ๋กœ ์ ‘์†ํ•˜์—ฌ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค. ์••์ถ•์„ ํ’€๊ณ  bin ํŒŒ์ผ ์•ˆ์— ์žˆ๋Š” ํด๋”๋ฅผ C:\spring ํด๋”์— ๋„ฃ์Šต๋‹ˆ๋‹ค. l ๋ฉ”์ด๋ธ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •ํ•˜๊ธฐ ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ฒฝ๋กœ๋ฅผ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์‹œ์Šคํ…œ ์†์„ฑ์—์„œ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค. ์ƒˆ๋กœ๋งŒ๋“ค๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ๋ณ€์ˆ˜์ด๋ฆ„์„ MAVEN_HOME์œผ๋กœ ํ•˜๊ณ  ์•„๊นŒ ๋ณต์‚ฌํ–ˆ๋˜ ๊ฒฝ๋กœ๋ฅผ ๋ถ™์—ฌ์ค๋‹ˆ๋‹ค. Path๋ฅผ ์„ ํƒํ•˜์—ฌ ํŽธ์ง‘..

article thumbnail
[Spring] @Autowired ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 11. 21:42

@Autowired๋ฅผ ์ด์šฉํ•˜๋ฉด xml์—์„œ ๋นˆ์„ ์ง์ ‘ ์„ค์ •ํ•  ํ•„์š”์—†์ด, ์Šคํ”„๋ง ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์•Œ์•„์„œ ์›ํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ์ฃผ์ž…์‹œ์ผœ์ค๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ ๋ฐ”๋กœ ์˜ˆ์‹œ๋ฅผ ๋ณด์—ฌ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค. l ์˜ˆ์‹œ package com.spring.ex02; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import o..

article thumbnail
[Spring] @RequestParam ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 11. 21:01

@RequestParam ์• ๋„ˆํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ’์„ ์–ป๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. l ์˜ˆ์‹œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ view์—์„œ ์•„์ด๋””๋ฅผ kbj, ์ด๋ฆ„์„ ๊น€๋ณ‘์ค€์œผ๋กœ ์ž…๋ ฅํ•˜๊ณ  ์ „์†กํ•ฉ๋‹ˆ๋‹ค. package com.spring.ex02; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.spri..

article thumbnail
[Spring] ์Šคํ”„๋ง ์–ด๋…ธํ…Œ์ด์…˜(Annotaion) ์ด๋ž€?
... 2021. 1. 10. 22:14

์Šคํ”„๋ง์˜ ๊ธฐ๋Šฅ๋“ค์ค‘ ํ•˜๋‚˜์ธ DI์™€ AOP๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋”ฐ๋กœ XML ํŒŒ์ผ์—์„œ ์„ค์ •์„ ํ•ด์•ผํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ XMLํŒŒ์ผ์— ์ด๋Ÿฌํ•œ ์„ค์ •๋“ค์„ ํ•˜๊ธฐ์—” ๋„ˆ๋ฌด๋‚˜ ๋ณต์žกํ•˜๊ณ  ์–ด๋ ค์› ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์Šคํ”„๋ง์—์„œ๋Š” DI ๊ฐ™์€ ์ž๋ฐ” ์ฝ”๋“œ์™€ ๊ด€๋ จ๋œ ์„ค์ •์€ ์ฝ”๋“œ์—์„œ ์ง์ ‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ๊ธฐ๋Šฅ์„ ์• ๋„ˆํ…Œ์ด์…˜(Annotation)์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ์Šคํ”„๋ง์—์„œ๋Š” XMLํŒŒ์ผ ์ง์ ‘ ์„ค์ •๊ณผ ์• ๋„ˆํ…Œ์ด์…˜ 2๊ฐœ๋ฅผ ํ˜ผํ•ฉํ•ด์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. l ์Šคํ”„๋ง ์• ๋„ˆํ…Œ์ด์…˜ ์ œ๊ณต ํด๋ž˜์Šค ์• ๋„ˆํ…Œ์ด์…˜์„ ์ด์šฉํ•˜๋ ค๋ฉด XML ํŒŒ์ผ์—์„œ ๋‹ค์Œ 2๊ฐœ์˜ ํด๋ž˜์Šค๋ฅผ ๋นˆ์œผ๋กœ ์„ค์ •ํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํด๋ž˜์Šค ๊ธฐ๋Šฅ DefaultAnnotationHandlerMapping ํด๋ž˜์Šค ๋ ˆ๋ฒจ์—์„œ @RequestMapping์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. AnnotationMethodHandlerMappin..

article thumbnail
[MyBatis] ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค include ๊ตฌ๋ฌธ ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 10. 21:08

๋งˆ์ด๋ฐ”ํ‹ฐ์Šค์—์„œ๋Š” ๋ฌธ๊ณผ ๋ฌธ์„ ์ด์šฉํ•˜์—ฌ sql๋ฌธ์„ ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค. l ๊ณผ AND NAME LIKE '%์ง€%' SELECT * FROM TEST_TABLE WHERE 1=1 ํƒœ๊ทธ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋งŒ๋“  sql๋ฌธ์€ ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๊ณตํ†ต์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” sql๋ฌธ์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ์— ์ ํ•ฉํ•ฉ๋‹ˆ๋‹ค. SELECT * FROM TEST_TABLE WHERE 1=1 AND NAME LIKE '%์ง€%'; '์ง€'๊ฐ€ ๋“ค์–ด๊ฐ€๋Š” NAME์„ ์ฐพ๋Š” ๊ตฌ๋ฌธ์ด๋ฏ€๋กœ ์œ„ ์ถœ๋ ฅ๊ฒฐ๊ณผ์˜ NAME์ด 'ํ™์ง€์›'์ธ๊ฑธ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. "๋‚œ ๋ฐ˜๋“œ์‹œ ๋ฐฑ์—”๋“œ ์™•์ด ๋ ๊ฑฐ์•ผ"

article thumbnail
[MyBatis] ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค foreach ๊ตฌ๋ฌธ ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 10. 20:55

foreach ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜๋ฉด SQL๋ฌธ์—์„œ ํ•œ๋ฒˆ์— ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํƒœ๊ทธ์˜ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์†์„ฑ ์†์„ฑ ์„ค๋ช… collection array์™€ list ์ธ์Šคํ„ด์Šค๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. list ์‹œ์—๋Š” list๋กœ ํ‘œ์‹œํ•˜๊ณ  array ์‹œ์—๋Š” array๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. index foreach๋ฌธ์ด ๋ฐ˜๋ณต๋ ๋•Œ๋งˆ๋‹ค 1์”ฉ ์ฆ๊ฐ€์‹œํ‚ค๋ฉด์„œ ์ ‘๊ทผํ•˜๋Š” ๊ฐ’์˜ ์œ„์น˜๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. item collection์˜ ์†์„ฑ์— ์ง€์ •๋œ ๊ฐ’์— ์ ‘๊ทผํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, ์†์„ฑ ์ด๋ฆ„์ด๋ผ๊ณ  ๋ณด์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. open ํ•ด๋‹น ๊ตฌ๋ฌธ์ด ์‹œ์ž‘๋  ๋•Œ์˜ ์ง€์ •ํ•œ ๊ธฐํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. close ํ•ด๋‹น ๊ตฌ๋ฌธ์ด ๋๋‚  ๋•Œ์˜ ์ง€์ •ํ•œ ๊ธฐํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. separator ๋ฐ˜๋ณต๋˜๋Š” ์ฟผ๋ฆฌ๋ฌธ ์‚ฌ์ด์— ์ง€์ •ํ•œ ๊ธฐํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. l ์˜ˆ์‹œ SELECT * FROM TEST_TABLE ..

article thumbnail
[MyBatis] ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค choose ๋ฌธ ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 10. 14:01

ํƒœ๊ทธ๋Š” switch๋ฌธ๊ณผ ๋น„์Šทํ•œ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. l ํƒœ๊ทธ SELECT * FROM TEST_TABLE WHERE 1=1 AND NAME=#{name} AND ID=#{id} AND NAME='ํ™์ง€์›' AND ID='ํ™์ง€์›' switch์˜ case ๋ฌธ์ฒ˜๋Ÿผ choose๋ฌธ์—์„œ๋Š” when ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์กฐ๊ฑด์•ž์—๋Š” ํ•ญ์ƒ test๋ฅผ ๋ถ™์—ฌ์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์œ„ ์ฝ”๋“œ์—์„œ๋Š” ๋งŒ์•ฝ name, id๊ฐ€ ์žˆ์œผ๋ฉด ์ฒซ๋ฒˆ์งธ when์ด, name๋งŒ ์žˆ์œผ๋ฉด ๋‘๋ฒˆ์งธ when์ด, id๋งŒ ์žˆ์œผ๋ฉด ์„ธ๋ฒˆ์งธ when ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค. public MemberVO selectIF() { sqlMapper = getInstance(); SqlSession session = sqlMapper.openSession(); MemberVO mem..

article thumbnail
[MyBatis] ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค if ๋ฌธ ์‚ฌ์šฉํ•˜๊ธฐ
... 2021. 1. 10. 13:40

๋งˆ์ด๋ฐ”ํ‹ฐ์Šค์—์„œ๋Š” ๋™์  ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€์˜ ํƒœ๊ทธ๋“ค์ด ์žˆ๋Š”๋ฐ, ์ด๋ฒˆ ๊ธ€์—์„œ ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. l if๋ฌธ์€ ๋‹ค๋ฅธ ์ฝ”๋“œ์—์„œ์™€์˜ if๋ฌธ๊ณผ ์‚ฌ์šฉ ์šฉ๋„๊ฐ€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ๋˜ ์‚ฌ์šฉ๋ฐฉ๋ฒ•๋„ ์•„์ฃผ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์ฃผ์˜ํ• ์ ์€ ๋ฐ˜๋“œ์‹œ ์กฐ๊ฑด๋ฌธ์•ž์— test=""๋ฅผ ์ ์–ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค. SELECT * FROM TEST_TABLE WHERE 1=1 AND name=#{name} ๋งŒ์•ฝ name์ด๋ผ๋Š” ๊ฐ์ฒด๊ฐ€ ์žˆ์œผ๋ฉด ํ•˜์œ„ ํƒœ๊ทธ๋ฅผ ์‹คํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์—†๋‹ค๋ฉด if ํƒœ๊ทธ์˜ ํ•˜์œ„ ํƒœ๊ทธ๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค. public MemberVO selectIF() { sqlMapper = getInstance(); SqlSession session = sqlMapper.openSession(); MemberVO memberVo = new MemberV..

article thumbnail
[Java] ์ž๋ฐ” List ๋ฐ˜๋ณต๋ฌธ (ํ–ฅ์ƒ๋œ ๋ฐ˜๋ณต๋ฌธ)
... 2021. 1. 10. 13:06

l List ๋ฐ˜๋ณต๋ฌธ ํ–ฅ์ƒ๋œ ๋ฐ˜๋ณต๋ฌธ์œผ๋กœ ์ž๋ฐ”์˜ ์ปฌ๋ ‰์…˜์ธ List๋ฅผ ๋ฐ˜๋ณต๋ฌธ ํƒœ์šฐ๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. public void put(String string, List resultList) { for(MemberVO vo : resultList) { System.out.println(vo); } } for(MemberVO vo : resultList) { System.out.println(vo); } ์—ฌ๊ธฐ์„œ List์˜ ๊ธธ์ด๋Š” 2์ž…๋‹ˆ๋‹ค. l ์ถœ๋ ฅ ๊ฒฐ๊ณผ ํ•ญ์ƒน๋œ ๋ฐ˜๋ณต๋ฌธ์€ List ๋ง๊ณ ๋„ ArrayList, HashMap, Map ๋“ฑ ์ž๋ฐ”์˜ ๋‹ค์–‘ํ•œ ์ปฌ๋ ‰์…˜์—์„œ๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. "๋‚œ ๋ฐ˜๋“œ์‹œ ๋ฐฑ์—”๋“œ ์™•์ด ๋ ๊ฑฐ์•ผ"

article thumbnail
[Oracle] ์˜ค๋ผํด seq ์ตœ๋Œ€๊ฐ’ ๊ตฌํ•˜๊ธฐ
... 2021. 1. 8. 14:12

์˜ค๋ผํด ํ…Œ์ด๋ธ”์— ์กด์žฌํ•˜๋Š” ๋ ˆ์ฝ”๋“œ๋“ค์ค‘ ์ตœ๋Œ€ seq๋ฅผ ๊ฐ€์ง€๋Š” ๋ ˆ์ฝ”๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ์‹ถ์„๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. l ์˜ˆ์‹œ ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฐ์ดํ„ฐ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ€์žฅ ํฐ seq์ธ 106์˜ row๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค. (๋งจ ์•ž ์ปฌ๋Ÿผ์ด seq์ž…๋‹ˆ๋‹ค.) SELECT ROWNUM, TEMP.* FROM ( SELECT * FROM TABLE_01 WHERE 1=1 ORDER BY SEQ DESC ) TEMP WHERE 1=1 AND ROWNUM = 1 ORDER BY๋กœ ์ˆœ์„œ๋ฅผ ์ •ํ•œ ๋’ค ROWNUM์„ ์ด์šฉํ•ด ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. l ๊ฒฐ๊ณผ ์‹คํ–‰ ๊ฒฐ๊ณผ ์ž˜ ๊ฐ€์ ธ์˜จ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์งˆ๋ฌธ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. "๋‚œ ๋ฐ˜๋“œ์‹œ ๋ฐฑ์—”๋“œ ์™•์ด ๋ ๊ฑฐ์•ผ"

article thumbnail
[MyBatis] ๋งˆ์ด๋ฐ”ํ‹ฐ์Šค selectOne๊ณผ selectList
... 2021. 1. 7. 21:26

๋งˆ์ด๋ฐ”ํ‹ฐ์Šค์—์„œ ์ œ๊ณตํ•˜๋Š” SqlSession ํด๋ž˜์Šค์—์„œ๋Š” CRUD๋ฅผ ์œ„ํ•œ ๋‹ค์–‘ํ•œ ๋ฉ”์„œ๋“œ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋Œ€ํ‘œ์ ์ธ select ๊ด€๋ จ ๋ฉ”์„œ๋“œ๋Š” ์•„๋ž˜ ํ…Œ์ด๋ธ”๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋ฉ”์„œ๋“œ ๊ธฐ๋Šฅ List selectList(query_id) id์— ๋Œ€ํ•œ select๋ฌธ์„ ์‹คํ–‰ํ•œ ํ›„ ๋ ˆ์ฝ”๋“œ๋ฅผ List๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. List selectList(query_id, '์กฐ๊ฑด') id์— ๋Œ€ํ•œ select๋ฌธ์„ ์‹คํ–‰ํ•˜๋ฉด์„œ ์กฐ๊ฑด(์ฟผ๋ฆฌ๋ฌธ์—์„œ ์‚ฌ์šฉํ•  ์ธ์ž)๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. T selectOne(query_id) id์— ๋Œ€ํ•œ select๋ฌธ์„ ์‹คํ–‰ํ•œ ํ›„ ํ•œ๊ฐœ์˜ ๋ ˆ์ฝ”๋“œ๋ฅผ ์ง€์ •ํ•œ ํƒ€์ž…์œผ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. T selectOne(query_id, '์กฐ๊ฑด') id์— ๋Œ€ํ•œ select๋ฌธ์„ ์‹คํ–‰ํ•˜๋ฉด์„œ ์กฐ๊ฑด(์ฟผ๋ฆฌ๋ฌธ์—์„œ ์‚ฌ์šฉํ•  ์ธ์ž)๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ์—ญ์‹œ ์ดํ•ดํ•˜๋Š”๋ฐ ์˜ˆ์‹œ๋ฅผ..

profile on loading

Loading...