Get parameter sent via jquery ajax in Java Servlet [duplicate]

I had the same issue with getParameter(“foo”) returning null in the servlet. Found a simple solution which might be useful to people here. Use the default value

contentType="application/x-www-form-urlencoded; charset=UTF-8"

or leave it out. This will automatically encode the request with the data in parameters.

Hope this helps…

Leave a Comment