0
我有一個應用程序spring mvc,查看模型是jsp頁面。 以前,我用JSTL爲了得到一個Java對象Knockoutjs從彈簧控制器加載數據
<select name="parallel" class="task-parallel">
<c:forEach var="listSchoolClasses" items="${listSchoolClasses}">
<option value='${listSchoolClasses.id}'>${listSchoolClasses.name}</option>
</c:forEach>
</select>
我的控制器:
@Controller
public class PageController {
@Autowired
SchoolClassesService schoolClassesService;
@RequestMapping("/tasks.htm")
public ModelAndView tasks() {
ModelAndView model = new ModelAndView("tasks");
model.addObject("listSchoolClasses", schoolClassesService.getAllSchoolClasses());
return model;
}
但現在我想用淘汰賽......用我如何在JSP頁面中的對象像這樣?
<select data-bind="options: ${listSchoolClasses}, value: ${listSchoolClasses.id}, optionsText: ${listSchoolClasses.name}"></select>
使用'@ ResponseBody'或'@ RestController'? – chrylis 2015-02-24 12:04:42
你能描述一下這些細節嗎? – Mary 2015-02-24 12:11:10