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
- like
- ์ฝํ
- ์ธ๋ผ์ธ๋ทฐ
- ๋ฆฌ๋ ์ค
- ๋์ปค
- ํ๋ก๊ทธ๋๋จธ์ค
- oracle
- ํจ์
- Spring
- order by
- ๋ฐฐ์ด
- ๋ณ์
- Update
- ๋ฐฑํฑ
- ํ ์ด๋ธ
- JavaScript
- select
- SQL
- ์ปจํธ๋กค๋ฌ
- ๋ช ๋ น์ด
- MySQL
- JSP
- JS
- Ajax
- ๋์
- ์๋ฐ์คํฌ๋ฆฝํธ
- ๋์ ํ ์ด๋ธ
- optionํ๊ทธ
- DATE_FORMAT
- post๋ฐฉ์
Archives
- Today
- Total
bom's happy life
Session์์ ๋ณ์๋ด์์ ํ์ id๊ฐ ๊ฐ์ ธ์ค๊ธฐ ๋ณธ๋ฌธ
Deveolpment Study๐๏ธ/Spring Framework
Session์์ ๋ณ์๋ด์์ ํ์ id๊ฐ ๊ฐ์ ธ์ค๊ธฐ
bompeach 2023. 4. 12. 15:47์ปจํธ๋กค๋ฌ์์ member_id๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด ์ธ์ ์์ ๊ฐ์ ธ์ค๋ ค๊ณ ํ๋๋ฐ ๊ฐ์ด ์๊พธ null์ด ๋ฌ๋ค.
๊ทธ๋์ jsp์์ ์ธ์ ์ member_id๋ฅผ ๋ด์์ ์ด๋ํด์คฌ๋๋ ๋ก๊ทธ์ธํ ํ์์ id๊ฐ ์ ์์ ์ผ๋ก ์ถ๋ ฅ๋๋ค!
jsp
<%
request.setCharacterEncoding("UTF-8");
String member_id = request.getParameter("member_id");
session.setAttribute("member_id", member_id);
%>
.
.
controller
@Override
@RequestMapping(value = "/ownerPageIntroModify.do", method = RequestMethod.GET)
public ModelAndView ownerPageIntroModify(@RequestParam Map<String, String> modifyMap,HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("text/html; charset=UTF-8");
request.setCharacterEncoding("utf-8");
ModelAndView mav = new ModelAndView();
HttpSession session = request.getSession();
session = request.getSession();
String member_id = (String) session.getAttribute("member_id");
System.out.println(member_id);
OwnerPageVO ownerPageVO = ownerPageService.ownerPageIntroView(member_id);
mav.addObject("ownerPageVO", ownerPageVO);
mav.setViewName("/owner/main/ownerPageIntroModify");
return mav;
}
์ฐธ๊ณ ๋ธ๋ก๊ทธ -->
https://chilas-it.tistory.com/157
[ JSP ] ์ธ์ Session ์ ํ์ฉํ ํ์ด์ง ๊ฐ ๋ฐ์ดํฐ ์ด๋ โ session.setAttribute() โ session.getAttribute()
input ํ๊ทธ์ id ์์ฑ์ ํ์ฉํ์ฌ ์ด์ ํ์ด์ง๋ก๋ถํฐ request.getParameter(id); ํ๋ ๊ฒ์ ์ค์ฝํ๊ฐ ์งง์ ํ์ด์ง ๊ฐ ์ด๋์ด ์ฆ๋ค๋ฉด ๋ถํธํ๋ค. ๋ฐ๋ผ์ ์ธ์ ์ ํ์ฉํ๋ค๋ฉด ๋ธ๋ผ์ฐ์ ๊ฐ ์ข ๋ฃ๋๊ธฐ ์ด์ ๊น์ง๋
chilas-it.tistory.com
'Deveolpment Study๐๏ธ > Spring Framework' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Spring] MVC - JSP์ ๋ฐ์ดํฐ ์ ๋ฌ (0) | 2023.05.18 |
---|---|
[Spring] <form:form>ํ๊ทธ (0) | 2023.05.04 |
์คํ๋งํ๋ ์์ํฌ ์ค์น๋ฐฉ๋ฒ (0) | 2023.03.30 |
์ฌ์ฉ์์๊ฒ alert ์ถ๋ ฅํ๊ณ redirect ํ๊ธฐ (0) | 2023.03.14 |
ํ์ํํด๊ธฐ๋ฅ๊ตฌํ (0) | 2023.02.06 |