您需要将此变量作为参数从发布/获取请求传递到控制器,并在控制器中进行访问,例如:
@RequestMapping(...)public String getCountySelected(@RequestParam(value = "UR_PARAM_NAME") String param){ ... pre goes here}编辑: 如果您不使用ajax,并且要在表单提交时发送额外的参数:
在带有
@Transient注释的表单域类中添加变量,以使spring不会在数据库表中查找匹配的元素。
例如
@Transientprivate String countrySelection;//Setter getter methods
然后在jsp中添加表单隐藏变量,例如:
<form:hidden path="countrySelection"/>
然后
$("#countrySelection").value(countrySelection);使用您的jquery 进行设置。在控制器中,您可以使用对象getter方法访问此字符串。



