使用spring做web开发,不知道用什么数据类型接收form表单,代码如下:
@RequestMapping( value="/editCategory", method = RequestMethod.POST )
public String onSaveCategory(
@RequestParam Map<String, String> selectcategory,
Model model,
HttpSession session
) throws Exception
{
System.out.println( "editCategory-post" );
Iterator<Map.Entry<String, String>> entries = selectcategory.entrySet().iterator();
while( entries.hasNext() )
{
Map.Entry<String, String> entry = entries.next();
System.out.println( entry.getKey() + " " + entry.getValue() );
}
return FORWARD_PATH_ARTICLETYPE;
}
html:
<form name="form_edit_category" action="editCategory" method="post">
<select id="selectcategory" style="float:left;" class="box"><!-- disabled-->
<option>hahaha</option>
</select>
<button class="btn btn-success" style="float:left" type="submit" >保存</button>
</form>
接收不到option的数据,怎么解决?
------解决思路----------------------
接收的是option的value,即<option value="">
后台用reques.getParamter("selectcategory");