2017-02-03 121 views
0

我在JSP上填充了内容表,每行有一个<button>当我们点击那个按钮表单值到控制器然后我将所有值设置为jsp使用model.addAttribute() 在那个jsp中,一些字段是下拉列表,现在我想将表单值作为默认值显示给下一个jsp,任何人都可以帮我进一步处理。在春天mvc显示默认值在下拉列表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); 
} 
+0

我没有得到你,我明白你的意思是你想显示一个默认选项'select'就像“Please select option”一样。请澄清,如果我错了。 – Amogh

回答

0

这应该给你,已经是路径上的价值,以及名单进一步改变或选择。

<form:select path="country"> 
    <form:option value="${country}" label="${country}" /> 
    <form:options items="${countryList}" itemLabel="country"/> 
    </form:select>