1
我基於以下屬性的用戶表:Spring MVC的JSP select標籤 - 對象列表GROUP BY
用戶(ID,名字,姓氏,年齡)。
所有用戶都按年齡分組,每個年齡段必須在選擇標籤中列出。
春控制器的方法:
@RequestMapping(value = "/listByAge")
public String listByAge(@ModelAttribute("user") User user, Model model){
model.addAttribute("ages", userService.groupByAge());
return "/listByAge";
}
JSP表單,選擇標籤:
<form:form action="/usersByAge/${age}" method="POST">
// The problem to list is here...
// I need to create a select tag
<button type="submit">List</button>
</form:form>
有人可以幫助解決這個問題?謝謝。
看看這個[回覆](http://stackoverflow.com/a/24390678/1066779) – Rembo 2015-04-04 03:45:43