标签:struts2
1.<span style="font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 25.200000762939453px;">表单标签中设置enctype="multipart/form-data"来确保匿名上载文件的正确编码。</span>
<s:form action="part_add.action" enctype="multipart/form-data"> <table> <tr><td><s:file name="file" label="检测报告"></s:file></td></tr> <tr><td><input type='submit' value='保存' id="save"></td></tr> </table> </s:form>
2.在Struts2.xml中加入
<constant name="struts.multipart.maxSize" value="9000000"/>
确保文件大小
标签:struts2
原文地址:http://blog.csdn.net/ahhmdwg/article/details/44997149