【发布时间】:2017-02-03 02:37:03
【问题描述】:
我在 JSP 上填充了目录,每一行都有一个 <button>,当我们单击该按钮时,表单值进入控制器,然后我使用 model.addAttribute() 将所有值设置为 jsp
在那个jsp中,一些字段现在是下拉列表我想将表单值显示为下一个Jsp的默认值,有人可以帮助我如何进一步进行吗?
我写的示例代码
在jsp中
<form:select path="country">
<form:options items="${countryList}" itemLabel="country"/>
</form:select>
在控制器方法中
@RequestMapping("/")
public String getClist(@ModelAttribute("form") FormBean fb){
sysout(fb.getCountry());
List<Country> c =userdao.getCountryList();
model.addAttribute("countryList",c);
}
【问题讨论】:
-
我没听明白,我的理解是您想向
select显示一个默认选项,例如“请选择选项”。如果我错了,请澄清。
标签: spring jsp model-view-controller