<%@page contentType=\"text/html\" pageEncoding=\"UTF-8\"%>
Since you post using multipart encoding ('multipart/form-data') the parameters are not present as you expect.
If for instance you are using commons-fileupload the parameters would be present as and are identifiable using the 'isFormField' method on the FileItem object.
This thead on coderanch explains how: coderanch
Most (every) modern webframeworks abstract this away and make this sort of stuff much easier by the way. Refer this site it will help you
CODE
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
for (FileItem item : items) {
if (item.isFormField()) {
// Process regular form field (input type="text|radio|checkbox|etc", select, etc).
String fieldname = item.getFieldName();
String fieldvalue = item.getString();
// ... (do your job here)
} else {
// Process form file field (input type="file").
String fieldname = item.getFieldName();
String filename = FilenameUtils.getName(item.getName());
InputStream filecontent = item.getInputStream();
// ... (do your job here)
}
}
} catch (FileUploadException e) {
throw new ServletException("Cannot parse multipart request.", e);
}
// ...
}
use Annotation
@MultipartConfig
for your Servlet