Model
값을 저장하고
view 쪽으로나 servlet(?) 쪽으로 보낼수 있음
< 1 >
Controller
정의
public String 함수(Model model) { return "페이지 또는 url" }
addAttribute()
값 (데이터)를 담음
다른 말로 jsp 페이지 변수를 전송
model.addAttribute(String key ,Object Value);
< 2 >
view - jsp
자바 spring에서 전송한 (Model) 키 값을 출력
방식이 많음...
EL (Expression Language) 표현식
${ key }
request.getAttribute()
값(데이터) 를 받음
<%= request.getAttribute("key")%>
JSTL 표현식
( core 사용 )
<c:out value="${key}"/>
'SpringBoot > code' 카테고리의 다른 글
SpringBoot - @PathVariable (0) | 2023.10.05 |
---|---|
SpringBoot - @ModelAttribute (0) | 2023.10.05 |
SpringBoot - @RequestParam (0) | 2023.10.05 |
SpringBoot - 어노테이션 (0) | 2023.10.04 |
SpringBoot - HelloWorld (0) | 2023.10.04 |