I know that if a parameter looks like this:
@RequestParam("userId") String userId
I can get the value by calling this:
requestParam.value()
But if I don’t specify a name, Spring automatically uses the variable name. Like this:
@RequestParam String userId
If the param name isn’t specified, how can I access it? I know its possible because Spring does it somehow, but requestParam.value() is blank in this case.
Spring doesn’t populate the request based on the @RequestParam. Rather it populates the method argument annotated with @RequestParam (in a method annotated with @RequestMapping). The parameter given to the @RequestParam annotation tells Spring the name of the request parameter you want it to use as that argument. If you don’t provide one, Spring defaults to using the name of the argument (so the 2 examples you give in your question are equivalent).
If you are trying to access a request parameter, you need to know the name of it, regardless of the framework you are using.