They can be used eg for data filtering, product details display. On the one hand, the following method is better than array variables – because it is much fewer robots, and on the other hand, the value of the parameter is obligatory. We can not ignore it or give only part of the parameters when called.

There is one new thing here: @RequestParam. In the annotation parameter, I specify a parameter name in the bar, which then returns to my variable Long. The call has the form:

And the outcome of the action is as follows:

If I do not give this parameter, Spring will remind him of it:

I did not specify a value for the parameter, it does not end up with an error, my variable will just be assigned null.

As part of such a small extension I will add that the parameters can obviously be more. I want to handle such a call, for example:

I have two parameters: category and subcategory. So I add another method, this time exchanging @RequestParam twice. Below the method with the output after the call.