I'm trying to call Spring Controller from JS with a requesParam but I'm always getting Required String parameter 'id' is not present
The call in my JSP:
window.location.href='controllerTest/controller1/function1?id='+idFromJSFunction;
My Controller:
@Controller
@RequestMapping(value = "/controller1")
public class Controller1{
@RequestMapping(value = "/function1")
public ModelAndView function1(@RequestParam("id") String idFromJSP, HttpServletRequest request,
RedirectAttributes redAttr) {
//Doing things
}
}
If I put reuired=false
, id is always null
.
Any hint?