私のプロジェクトは、Spring MVC を使用したポートレットです。コードを即興化したいので、<form:select>
代わりに<select>
. 使用するにはどのような変更が必要か知りたいです。選択した値をコントローラーに返す必要があります。
jsp:
<form:form modelAttribute="drpdownValue" method="get" action="${URL_EOBLIST}">
<form:select path ="values">
<form:options items="${dropValues}"/>
</form:select>
</form:form>
モデルクラス:
public class DropDownValues {
String values;
public String getValues() {
return values;
}
public void setValues(String values) {
this.values = values;
}
}
コントローラ:
@RequestMapping
public String initialize(RenderRequest renderRequest){
ModelMap modelMap=new ModelMap();
modelMap.addAttribute("drpdownValue",new DropDownValues());
return "formTable";//jsp name
}
@ModelAttribute("dropValues")
public List<String> getList(){
List<String> dropdown=new ArrayList<String>();
dropdown.add( "All Available");
dropdown.add( "Last 18 Months");
dropdown.add( "Last 12 Month");
dropdown.add( "Last 6 Months");
dropdown.add( "Last 3 Months");
return dropdown;
}