I don't know where the @RequestParam should come from. I think that's the crux of the problem.
Yes, absolutely. The @RequestParam
javadoc states
Annotation which indicates that a method parameter should be bound to a web request parameter.
It can't do that if you don't have an appropriate request parameter. In your case, it doesn't seem like you have a request parameter for
@RequestParam int id
where the name of the request parameter will be id
since you have provided a value
attribute to @RequestParam
. You need to provide such a request parameter, possibly with an <input>
element.