当用户单击提交表单的搜索按钮时,我需要从 jsp 传输下拉列表中选择的值。
<form:form modelAttribute="firstVO" method="post">
<form:select path="secondVO.status"
id="status" >
<form : option value="all" label="All" />
<form : option value="new" label="New" />
</form:select>
<input type="button" name="search" value="Search" onclick="filterData();" />
</form:form>
function filterData(){
document.forms[0].action = Path+"/filter.do";
document.forms[0].submit();
}
-------------------------------------------------
public class FirstVO {
private SecondVO secondVO;
}
public class SecondVO {
private String status;
}
public class DPSController {
@RequestMapping(value = "/filter.do")
public ModelAndView filterDashboard(HttpServletRequest request, @ModelAttribute SecondVO secondVO) {
System.out.println("secondVO.getStatus:"+secondVO.getStatus());
}
}
注意:DPSController 是打印状态选择值的动作类。
Any idea please?