-
카테고리
-
세부 분야
백엔드
-
해결 여부
해결됨
HelloController 오류 질문(addAttribute 오류)
24.04.12 17:21 작성 24.04.12 17:22 수정 조회수 68
0
package hello.hellospring.controller;
import ch.qos.logback.core.model.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controllerpublic class HelloController {
@GetMapping("hello")
public String hello(Model model) {
model.addAttribute("data", "hello!!");
return "hello";
}
위에 사진 처럼 addAttribute에 빨간 줄이 떴는데 얘는 어떻게 하나요?
Cannot resolve method 'addAttribute' in 'Model'
오류 코드입니다.
C:\Users\kimga\OneDrive\바탕 화면\hello\hello-spring\src\main\java\hello\hellospring\controller\HelloController.java:12:13
java: cannot find symbol
symbol: method addAttribute(java.lang.String,java.lang.String)
location: variable model of type ch.qos.logback.core.model.Model
답변을 작성해보세요.
답변 1