Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- select
- ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ช ๋ น์ด
- DATE_FORMAT
- ํจ์
- Update
- like
- ํ ์ด๋ธ
- Ajax
- ํ๋ก๊ทธ๋๋จธ์ค
- SQL
- Spring
- post๋ฐฉ์
- optionํ๊ทธ
- JSP
- JS
- ๋์ปค
- ๋ฆฌ๋ ์ค
- oracle
- MySQL
- ์ธ๋ผ์ธ๋ทฐ
- ์ฝํ
- ๋ฐฐ์ด
- JavaScript
- ์ปจํธ๋กค๋ฌ
- order by
- ๋์
- ๋ณ์
- ๋์ ํ ์ด๋ธ
- ๋ฐฑํฑ
Archives
- Today
- Total
bom's happy life
[Spring] @RequestMapping _ GET๋ฐฉ์, POST ๋ฐฉ์ ๋ณธ๋ฌธ
Deveolpment Study๐๏ธ/Spring Framework
[Spring] @RequestMapping _ GET๋ฐฉ์, POST ๋ฐฉ์
bompeach 2023. 6. 5. 20:17JSP์์ ์ปจํธ๋กค๋ฌ๋ก ๋ฐ์ดํฐ๋ฅผ ๋ณด๋๋๋ฐ null๊ฐ์ด ๋จ๋ ์ด์ ๊ฐ ๋ฌด์์ธ์ง ์์นํ๋ค๊ฐ ์๊ฒ ๋๊ฑฐ ์ ๋ฆฌ~
๊ทธ์ค์ ๋ด ๊ฒฝ์ฐ์ ํด๋นํ๋ ์ด์ !
โ์์ฒญ์ด POST ๋ฐฉ์์ด ์๋ GET ๋ฐฉ์์ผ๋ก ์ ๋ฌ๋์๋์ง ํ์ธํด๋ณด๊ธฐโ
@RequestMapping ์ด๋
ธํ
์ด์
์ ์ฌ์ฉํ ๋, ๊ธฐ๋ณธ์ ์ผ๋ก GET ๋ฐฉ์์ผ๋ก ์์ฒญ์ ์ฒ๋ฆฌํ๋ค. ๋ฐ๋ผ์, ์์ฒญ์ POST ๋ฐฉ์์ผ๋ก ์ ๋ฌํ๋ ค๋ฉด @RequestMapping ์ด๋
ธํ
์ด์
์ method ์์ฑ์ ์ถ๊ฐํ์ฌ POST ๋ฐฉ์์ ๋ช
์ํด์ผํ๋ค.
JSP์์ POST ๋ฐฉ์์ผ๋ก ๋ณด๋ด๋ ์ฝ๋
var form = document.createElement("form");
form.setAttribute("charset", "utf-8");
form.setAttribute("method", "POST"); //POST ๋ฐฉ์
form.setAttribute("action", "/reservation.do");
--์ค๋ต--
์ปจํธ๋กค๋ฌ์์ POST ๋ฐฉ์ ๋ฐ๊ธฐ!
@RequestMapping ์ด๋ ธํ ์ด์ ์ method ์์ฑ์ ์ถ๊ฐํ์ฌ POST ๋ฐฉ์์ ๋ช ์ํ๋ ๋ฐฉ๋ฒ
@RequestMapping(value = "/reservationForm.do", method = RequestMethod.POST)
public String reservationForm(Model model, HttpServletRequest request) throws Exception {
// ๋ฉ์๋ ๋ด์ฉ
}
method = RequestMethod.POST ์ด๋ ๊ฒ ๋ฐ์์ฃผ๋ฉด ๊ฐ์ด ์ ๋์ด์ค๋ ๊ฒ์ ํ์ธํ ์ ์๋ค!
'Deveolpment Study๐๏ธ > Spring Framework' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Spring] ์คํ๋ง ํ๊ธ๊นจ์ง ๋ฌธ์ ํด๊ฒฐํ๊ธฐ(ํ๊ธ ์ธ์ฝ๋ฉ) (0) | 2023.08.07 |
---|---|
[Spring] JS๋ก <form>ํ๊ทธ ๋์ ์ผ๋ก ์์ฑํด์ ํ์ฉํ๊ธฐ (0) | 2023.06.05 |
[Spring] JSP์์ ๋ณด๋ธ ๋ฐ์ดํฐ Java์์ ๋ฐ๋ ๋ฐฉ๋ฒ (0) | 2023.06.05 |
[Spring] MVC - JSP์ ๋ฐ์ดํฐ ์ ๋ฌ (0) | 2023.05.18 |
[Spring] <form:form>ํ๊ทธ (0) | 2023.05.04 |