Thymeleafとspringで画面を作ろうとした際
URLにアクセスすると以下のようなエラーが出力されます。
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jun 24 22:35:24 JST 2016
There was an unexpected error (type=Internal Server Error, status=500).
com.qiita.demo.web.controller.TestController.home(Lcom/qiita/demo/web/form/TestForm;Lorg/springframework/web/servlet/ModelAndView;)Lorg/springframework/web/servlet/ModelAndView;
これは何が原因で発生しているエラーなのでしょうか
html
1<!DOCTYPE html> 2<html xmlns ="http://www.w3.org/1999/xhtml" 3xmlns:th ="http://www.thymeleaf.org" 4xmlns:layout ="http://www.ultraq.net.nz/thymeleaf/layout" 5layout:decorator="base"> 6 7<head> 8<title>test</title> 9<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> 10 </head> 11<body> 12<div class="panel-body"> 13<form th:action="@{test}" th:object="${form}" method="post"> 14 <div class="table-responsive table-x-scroll"> 15 <table class="table table-bordered table-striped table-condense"> 16 <thead class="sunflower"> 17 <tr> 18 <td>ID</td> 19 <td>NAME</td> 20 </tr> 21 </thead> 22 <tbody th:each="beans : ${form}"> 23 <tr> 24 <td class="text-str" th:text="${beans.getId}"></td> 25 <td class="text-str" th:text="${beans.getName}"></td> 26 </tr> 27 </tbody> 28 </table> 29 </div> 30</form> 31</div> 32</body> 33</html>
java
1@Controller 2public class TestController { 3 4 5 @RequestMapping(value = "/test") 6 @ResponseBody 7 public String home(TestForm form, Model model) { 8 List<TestBean> details = new ArrayList<TestBean>(); 9 details = getList(); 10 form.setList(details); 11 model.addAttribute("form", form); 12 13 return "test"; 14 } 15 16 17 18 19 20 public List<TestBean> getList(){ 21 List<TestBean> list = new ArrayList<TestBean>(); 22 TestBean a = new TestBean(); 23 a.setId(1); 24 a.setName("aaa"); 25 list.add(a); 26 TestBean b = new TestBean(); 27 b.setId(2); 28 b.setName("bbb"); 29 list.add(b); 30 TestBean c = new TestBean(); 31 c.setId(2); 32 c.setName("ccc"); 33 list.add(c); 34 return list; 35 } 36 37}
宜しくお願いいたします。