if we use RequestParam annotation in Spring Controller like this :
The request sent by the client was syntactically incorrect ()
@RequestMapping(value="/viewFileDetails",method=RequestMethod.GET)
public String getDetails(Model model,@RequestParam String userId){
if(userId !=null && !userId.isEmpty())
{
List beans = fileDetailsDAO.getPermittedFiles(Integer.parseInt(userId));
model.addAttribute("files",beans);
}
return "viewFileDetails";
}
now spring will expect userId parameter in query string of the url. If we fail to provide the value for this parameter we get following 400 error . so the url should be like /viewFileDetails?userId=12 or we can add @RequestParam(required=false) in the annotation to mark this parameter optionalThe request sent by the client was syntactically incorrect ()