MapleStory Finger Point

๐ŸŸค JAVA 102

[SpringBoot] ajax / fetch

โ—ˆ AJAX (Asynchronous JavaScript and XML) ๋ž€?AJAX๋Š” ์—ฌ๋Ÿฌ ๊ธฐ์ˆ ์„ ์กฐํ•ฉํ•˜์—ฌ ๋น„๋™๊ธฐ์ ์œผ๋กœ ์„œ๋ฒ„์™€ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ๋ฐฉ๋ฒ•  โ—ˆ Fetch API ๋ž€?Fetch API๋Š” AJAX์™€ ๋น„์Šทํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ์ตœ์‹  ์›น API๋กœ, ํ”„๋กœ๋ฏธ์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋น„๋™๊ธฐ ์š”์ฒญ์„ ๋”์šฑ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ฒ˜๋ฆฌ     ํƒ€์ž„๋ฆฌํ”„๋กœ ๋งŒ๋“ค์–ด์ง„ ๋ทฐ ์ž…๋‹ˆ๋‹ค. get๋ฐฉ์‹ post๋ฐฉ์‹ ex01 ex02

[SpringBoot / ์‹ค์Šต] ๋ฉ”๋ชจ ๊ธฐ๋Šฅ (๋“ฑ๋ก,์กฐํšŒ,์œ ํšจ์„ฑ,๋น„๋ฐ€๊ธ€)

memoWrite๋ฉ”๋ชจ ๋“ฑ๋กmemoList๋ฉ”๋ชจ ์กฐํšŒ@Valid ์œ ํšจ์„ฑ๊ฒ€์‚ฌsecret ์— ('y' / 'n') ์œผ๋กœ ์ €์žฅ๊ณต๊ฐœ๊ธ€/๋น„๋ฐ€๊ธ€     โ—ˆ MySQL ํ…Œ์ด๋ธ” ์ƒ์„ฑCREATE TABLE MEMO_TEST(MNO INT PRIMARY KEY AUTO_INCREMENT,MEMO VARCHAR(200) NOT NULL,PHONE VARCHAR(30),PW VARCHAR(4),SECRET CHAR(1) CHECK(SECRET IN ('y', 'n')));  โ—ˆ Controllerpackage com.simple.basic.controller;import com.simple.basic.command.MemoVO;import com.simple.basic.memo.MemoService;import org.sprin..

[SpringBoot] thymeleaf ํƒ€์ž„๋ฆฌํ”„ ๊ฐœ๋…

โ—ˆ  thymeleaf ํƒ€์ž„๋ฆฌํ”„Thymeleaf๋Š” ์„œ๋ฒ„ ์‚ฌ์ด๋“œ Java ํ…œํ”Œ๋ฆฟ ์—”์ง„์œผ๋กœSpring Boot์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ๋ทฐ ํ…œํ”Œ๋ฆฟ ๊ธฐ์ˆ ์ด๋‹ค. jstl ๊ณผ ๋น„์Šทํ•˜๋‹ค. ๋ถ€ํŠธ๋Š” ๊ฐ€๋Šฅํ•˜๋ฉด jsp ๋ฅผ ํ”ผํ•˜๊ณ  thymel๊ฐ™์€ view ํ…œํ”Œ๋ฆฟ ์—”์ง„์„ ์‚ฌ์šฉํ•˜๋ผ๊ณ  ๊ถŒ์žฅํ•œ๋‹ค. !! ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ•  ๋•Œ, ๊ธฐ๋ณธ์ ์œผ๋กœ ํ™”๋ฉด ํ…œํ”Œ๋ฆฟ ์—”์ง„์ด ์„ค์ •๋˜์–ด ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—,์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ทฐ(View) ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด Thymeleaf์™€ ๊ฐ™์€ ํ…œํ”Œ๋ฆฟ ์—”์ง„์„ ์ถ”๊ฐ€    โ—ˆ ํƒ€์ž„๋ฆฌํ”„ ์‹œ์ž‘ํ•˜๊ธฐ1. ํƒ€์ž„๋ฆฌํ”„ ์˜์กด์„ฑ ์ถ”๊ฐ€ํ•˜๊ธฐimplementation 'org.springframework.boot:spring-boot-starter-thymeleaf'2. html ํŒŒ์ผ๋กœ ์ž‘์„ฑํ•œ๋‹ค.3. ์ตœ์ƒ๋‹จ์—  xmlns:th ๋ช…์‹œํ•ด์ค€๋‹ค. (๋ช…์‹œํ•ด์ฃผ๋Š” ํŽธ์ด..

[Spring] XML & Annotation ์„ค์ • (+ ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ฆฌ)

๋ชฉ์ฐจ  1. xml ๊ธฐ๋ฐ˜ ์„ค์ •`applicationContext.xml` ๊ฐ™์€ ์„ค์ •ํŒŒ์ผ์— Bean ์„ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•  `` : xml ์„ค์ •์˜ ์ตœ์ƒ์œ„ ์š”์†Œ, Bean ์ •์˜`` : ์‹ค์ œ Bean ์„ ์ •์˜ํ•˜๋Š” ์š”์†Œ id ๋Š” Bean ์ด๋ฆ„ / class ๋Š” Bean ๊ตฌํ˜„ ํด๋ž˜์Šค`` : ๊ฐ์ฒด๋ฅผ ์ฃผ์ž…ํ•˜๋Š” ๋ถ€๋ถ„ , ref ์†์„ฑ์€ ๋‹ค๋ฅธ Bean ์ด๋ฆ„์„ ์ฐธ์กฐํ•˜์—ฌ ์ฃผ์ž…   2. ์–ด๋…ธํ…Œ์ด์…˜ ๋ฐฉ์‹ Spring ์—์„œ๋Š” ๋‹ค์–‘ํ•œ ์Šคํ…Œ๋ ˆ์˜คํƒ€์ž… ์–ด๋…ธํ…Œ์ด์…˜ ์„ ์‚ฌ์šฉํ•˜์—ฌ Bean ์„ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋‹ค. !์ฝ”๋“œ๋‚ด์—์„œ ์„ค์ • ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ์„ค์ •์ด ๊ฐ„๊ฒฐํ•˜๊ณ  ํŽธ๋ฆฌํ•ด์ง„๋‹ค. โ˜บ๏ธ * ์Šคํ…Œ๋ ˆ์˜คํƒ€์ž… ์–ด๋…ธํ…Œ์ด์…˜ : Spring Framework์—์„œ ๋นˆ์„ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ํŠน์ˆ˜ํ•œ ์ข…๋ฅ˜์˜ ์–ด๋…ธํ…Œ์ด์…˜  @Comp..

[Spring] request, response

//voidํ˜•์€ ๋“ค์–ด์˜จ ์š”์ฒญ ๊ฒฝ๋กœ๊ฐ€, ๋‚˜๊ฐ€๋Š” ๊ฒฝ๋กœ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค(ํ™”๋ฉด๊ฒฝ๋กœ) @RequestMapping("/req_ex01") public void ex01() { } @RequestMapping("/req_ex01") public String ex01() { return "request/req_ex01"; //ํ™”๋ฉด๊ฒฝ๋กœ }   //@RequestMapping(value = "/basic", method = RequestMethod.GET) //get๋งŒ ํ—ˆ์šฉํ•จ //@RequestMapping(value = "/basic", method = RequestMethod.POST) //post๋งŒ ํ—ˆ์šฉํ•จ //@RequestMapping("/basic") //get, post ๋‘˜๋‹ค ํ—ˆ์šฉํ•จ @Reques..

[Spring / ์‹ค์Šต1] ์ ์ˆ˜ ๋“ฑ๋ก ํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ (์™„์„ฑโญ)

์ด๋ฆ„๊ณผ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•œ ํ›„  [์ ์ˆ˜ ๋“ฑ๋ก] ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ๋‹ค.      ์ ์ˆ˜๊ฐ€ ์ž˜ ๋“ฑ๋ก๋˜์—ˆ๋‹ค๋Š” ํ™”๋ฉด์ด ๋œฌ๋‹ค.     [๋ชฉ๋กํŽ˜์ด์ง€] ๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ด๋ ‡๊ฒŒ ๋“ฑ๋ก๋˜์–ด์žˆ๋Š” ํ‘œ๊ฐ€ ๋œจ๊ณ     [์ ์ˆ˜๋“ฑ๋ก] or [์ถ”๊ฐ€๋“ฑ๋กํ•˜๊ธฐ] ๋งํฌ๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋‹ค์‹œ ๋“ฑ๋ก ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•œ๋‹ค.    ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—๋„ ๊ฐ’์ด ์ž˜ ๋“ค์–ด์˜ด์„ ํ™•์ธ ๊ฐ€๋Šฅํ•˜๋‹ค!