I am tring to retrieve a filename or the file itself for use in a java servlet (from a web form).
I have a file form field:
<form enctype="multipart/form-data" method="post" action="SaveDictionary.do">
<label>
<input type="file" name="dictionary_file" id="dictionary_file" />
<br />
</label>
<label>
<br />
<input type="submit" name="saveDic" id="saveDic" value="Save Dictionary" />
</label>
</form>
I wanto then process it in my servlet, what do I do to process this - for a normal text field I would use something like
String myValue = (String) request.getParameter("parameter_name");
Assuming I have this class, what do I put in the doPost() method to get either the file path or the actual file contents.
@SuppressWarnings("serial")
public class SaveDictionary extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
// I can t work out what goes here, the same
// String myValue = (String) request.getParameter("parameter_name"); doesn t work
response.sendRedirect("dictionary.jsp");
}
}