I have created a hidden form element
The servlet parses the parameters by default using application/x-www-form-urlencoded
encoding. The multipart/form-data
encoding however isn't supported in servlets until Servlet 3.0. The getParameter()
calls will all return null
.
In Servlet 3.0, you should have used HttpServletRequest#getParts() instead to get all parts of a multipart/form-data
request, including normal form fields. Prior to Servlet 3.0, you should have used Apache Commons FileUpload to parse multipart/form-data
requests. See also the following answer for a detailed example of both approaches: How to upload files to server using JSP/Servlet?
Note that if you aren't using any field at all, then you can just leave the encoding away from the
. It will then default to
application/x-www-form-urlencoded
.