相信您应该
<form:select>在内使用
<form:form>。
它看起来应该像这样:
search.jsp:
<form:form modelAttribute="myform" action="result" method="get" > <form:select path="nameOfInstitution"> <form:option value="NONE"> --SELECT--</form:option> <form:options items="${listOfInstitutionsNames}"></form:options> </form:select> ...</form:form>
HomeController.java:
@RequestMapping(value = "/search", method = RequestMethod.GET)public String search(Model model) { ... model.addAttribute("myform", new MyForm()); return "search";}@RequestMapping(value = "/result", method = RequestMethod.GET)public String SecondActionPage(@RequestParam String nameOfInstitution, Model model, @ModelAttribute("myform") MyForm myform) throws Exception { ...}
MyForm.java:
public class MyForm { private String nameOfInstitution; public String getNameOfInstitution() { return nameOfInstitution; } public void setNameOfInstitution(String nameOfInstitution) { this.nameOfInstitution = nameOfInstitution; }}
希望这可以帮助。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)