2017  Kodetalk | Feedback | Privacy Policy | Terms | About

Spring MVC - RequestParamException parameter is not present

I"ve got an issue that occurs eventually in my website. It uses AJAX requests to get data from the server, which uses Spring MVC.

What happens (intermittently) is that sometimes we got an exception like this one:

org.springframework.web.bind.MissingServletRequestParameterException: Required Integer parameter "page" is not present at 

This kind of exception occurs in some AJAX POST calls (not only for this case!!) and we still cannot reproduce it to understand what is happening.

For example, in one of the cases the parameter "page" (used to load content while the user scrolls the page - so it"s a required variable) is being sent through an AJAX call that has a "data" field with the page parameter coming from a form like this:

<input type="hidden" name="page" id="page" value="1">

And a ajax call like this one (both $("#filter") and url are ok):

    type: "POST",
    data: $("#filter").serialize(), // serializes the form"s elements.     url: _ctx + URL_FILTER,     cache: false })


The only way we got to reproduce that is by changing its property "name" to something other than "page". But I guess this is not the case (most users don"t even open the developer console...)

I"ve googled it a lot and I checked every possibility. The enconding is ok:

(Content-Type: application/x-www-form-urlencoded; charset=UTF-8) 

The parameters are ok, the AJAX looks ok, everything seems ok... But we cannot find what is going on. We have tried a lot of possibilities but we still couldn"t force these exceptions to happen.

One hypothesis we have is that sometimes the AJAX may send empty data blocks, with none of the parameters. But we don"t even know whether it"s true or not and how to check its veracity.

What are the possibilities? How can it be tested?

Answer is