struts上传文件的大小默认是比较小的只有2M,可以进行设置
步骤1:struts.xml
步骤 1 : struts.xml
设置上传文件最大大小为10m
<? xml version = "1.0" encoding = "UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
< struts >
< constant name = "struts.multipart.maxSize" value = "10240000" />
< package name = "basicstruts" extends = "struts-default" >
< action name = "showProduct" class = "com.how2java.action.ProductAction" method = "show" >
< result name = "show" >show.jsp</ result >
</ action >
< action name = "addProduct" class = "com.how2java.action.ProductAction" method = "add" >
< result name = "input" >addProduct.jsp</ result >
< result name = "show" >show.jsp</ result >
</ action >
< action name = "upload" class = "com.how2java.action.UploadAction" method = "upload" >
< result name = "success" >success.jsp</ result >
</ action >
</ package >
</ struts >
|
关注我,分享更多Java全栈技术
更多Java全栈技术内容,点击了解: https://how2j.cn/k/struts/struts-upload-max/72.html