我正在尝试使用requesParam从JS调用Spring Controller,但我总是得到Required String parameter 'id' is not present
我的JSP中的调用:
window.location.href='controllerTest/controller1/function1?id='+idFromJSFunction;
我的控制器:
@Controller
@RequestMapping(value = "/controller1")
public class Controller1{
@RequestMapping(value = "/function1")
public ModelAndView function1(@RequestParam("id") String idFromJSP, HttpServletRequest request,
RedirectAttributes redAttr) {
//Doing things
}
}
如果我提出reuired=false
,则ID始终为null
。
任何提示?