2017-09-08 1 views
0

에 표시되지 않습니다. 내 컨트롤러에서 뷰로 전달하려고하는 데이터가 명백하게 무시됩니다. 콘솔은 오류를 출력하지 않습니다. 누군가 내가 분명히 한 명백한 실수를 지적 할 수 있습니까?Spring : ModelMap 속성이 jsp

컨트롤러

@RequestMapping("/notes") 
public String index(ModelMap model) { 
    String test = "Hello Felix"; 
    model.addAttribute("hello", test); 

    return "notes"; 
} 

보기

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ page contentType="text/html; charset=UTF-8" %> 
<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Notes</title> 
</head> 
<body> 
    <h1>${hello}</h1> 
</body> 
</html> 

HTML 소스

<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Notes</title> 
</head> 
<body> 
    <h1></h1> 
</body> 
</html> 

답변

0

당신은 모드를 반환해야 엘, 다음과 같은 것이 작동해야합니다 :

Map model = ... 
model.put(name, value); 
return new ModelAndView(view, model); 
관련 문제