The action above provides two properties: Uploadfilename and Uploadcontenttype, which are used to marshal the file names of the uploaded files, and the file types of the uploaded files, respectively. The action class directly encapsulates the file content of the uploaded file directly through the file Type property, but this file property cannot get the file name and type of the uploaded files, so struts 2 encapsulates the upload file name and file type information contained in the domain directly into the Uploadfilename and Uploadcontenttype properties. It can be thought that if the form contains a file field with the Name property of XXX, the corresponding action requires three properties to encapsulate the file field information
1, the type of file of the XXX attribute encapsulates the other file domain corresponding to the content of the files.
2. The Xxxfilename property of type string encapsulates the file name corresponding to the file field.
3. The Xxxcontenttype property of type string encapsulates the file type of the file that corresponds to the file field.
With the 3 properties above, it is easier to implement file properties, so in the Execute method, you can get the file name, file type, and file contents of the uploaded files directly by calling the GetXXX () method.
About the action class using the file type to get the contents of the uploaded files, name and content type