0
我想使用彈簧控制器將簡單列表值打印到選擇框。它成功返回所有值使用彈簧<form:select>不打印任何東西
${test}
但是,雖然我想這不起作用。解決方案將欣賞。
控制器
@RequestMapping(value="/flight", method = RequestMethod.GET)
public ModelAndView homePage(CountryCodes country) {
//model.addAttribute("userName", user.getUserName());
/*List<CountryCodes> countryCodes = userService.getCountryCodes();
model.addAttribute("codes", countryCodes);*/
ModelAndView mv= new ModelAndView("FlightDetails");
List<String> test = new ArrayList<String>();
test.add("Human Resources");
test.add("Finance");
test.add("Admin");
test.add("Quality Assurance");
test.add("Products");
mv.addObject("test", test);
return mv;
}
選擇在JSP箱
${test}
<form:select path="country" class="form-control">
<form:options items="${test}" class="form-control"/>
</form:select>