On the jsp page, you must send the servlet an additional string value when you press the button (the button that loads the file).
"<input type=\"submit\" value=\"Upload File\"></input>" How to do it in the POST method?
if(c.getDocument() == null) { out.println("Загрузка документа:<br><br>" + "Выбрать файл для загрузки: <br />" + "<form action=\"/upload\" method=\"post\"" + "enctype=\"multipart/form-data\">" + "<input type=\"file\" name=\"file\" size=\"50\"/>" + "<br />" + "<input type=\"submit\" value=\"Upload File\"></input>"+ "</form>"); } else { out.println(c.getDocument()); }
nameattribute with the value you need, that is, as for any other form element ... - Roman Grinyov