Documents saved as getpart

Servlet 3.0 supports two additional HttpServletRequest methods:

The request.getParts() method returns collections of all Part objects. If you have more than one input of type file, multiple Part objects are returned. Since Part objects are named, the getPart(String name) method can be used to access a particular Part. Alternatively, the getParts() method, which returns an Iterable , can be used to get an Iterator over all the Part objects.

The javax.servlet.http.Part interface is a simple one, providing methods that allow introspection of each Part. The methods do the following:

For example, the Part interface provides the write(String filename) method to write the file with the specified name. The file can then be saved in the directory specified with the location attribute of the @MultipartConfig annotation or, in the case of the fileupload example, in the location specified by the Destination field in the form.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices