利用struts2上传文件 环境配置JDK1.8 Eclipse 版本
Version: Mars Release (4.5.0) tomcat版本7.0.40
注意的问题是文件上传的时候的enctype="multipart/form-data"
如果设置错误会报错
今天初次使用Struts 2做文件上传,出现了一个错误,
ognl.MethodFailedException: Method "setUpload" failed for object
文件类型的限制会在struts.xml中进行配置
几种常见的类型,图片格式image/jpeg,image/gif
word文档格式doc :application/msword
word文档格式docx :application/vnd.openxmlformats-officedocument.wordprocessingml.document