struts2上传文件大小受限问题
用struts2框架,页面上传文件到action处理,结果文件根本就没到后台action去,经过查资料,解决办法是在struts.xml中加上一句配置如下:
<?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.devMode" value="true" />
<constant name="struts.i18n.encoding" value="utf-8" />
<!--上传最大大小为50M-->
<constant name="struts.multipart.maxSize" value="52428800"/>
<!--默认模块-->
<package name="default" abstract="true" namespace="/" extends="struts-default">
<!-- 自定义拦截器 -->
<interceptors>
<interceptor name="loginJudge" class="com.keyman.fss.action.LoginInterceptor"></interceptor>
<interceptor name="EncodingJudge" class="com.keyman.fss.action.EncodingInterceptor"></interceptor>
<!-- 自定义拦截器栈 -->
<interceptor-stack name="myDefaultStack">
<interceptor-ref name="loginJudge"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<!-- 将自定义拦截器栈设置默认的拦截器 -->
<default-interceptor-ref name="myDefaultStack"/>
<!-- 定义全局的result -->
<global-results>
<result name="login" type="redirect">/default/session_timeout.jsp</result>
<result name="error">/error/error.jsp</result>
<result name="acotrError">/default/bylogin_out.jsp</result>
</global-results>
</package>
<!-- 掌机管理 -->
<package name="equipment" namespace="/equipment" extends="default">
<action name="getAllProvider" class="com.keyman.fss.action.EquipmentAction" method="getAllProvider">
<result name="success">/equipment/provider.jsp</result>
</action>
<action name="abandonSchedule" class="com.keyman.fss.action.EquipmentAction" method="abandonSchedule">
<result name="success" type="chain">
<param name="actionName">getAllSchedule</param>
</result>
</action>
<action name="getAllSoftware" class="com.keyman.fss.action.EquipmentAction" method="getAllSoftware">
<result name="success">/equipment/software.jsp</result>
</action>
<action name="getSoftwareById" class="com.keyman.fss.action.EquipmentAction" method="getSoftwareById">
<result name="success">/equipment/addUpdateSchedule.jsp</result>
</action>
<action name="addSoftware" class="com.keyman.fss.action.EquipmentAction" method="addSoftware">
<result name="success">/equipment/addSoftware.jsp</result>
</action>
</package>
</struts>
参考网络资料:
http://blog.163.com/wsslian@126/blog/static/77635189201212434857504/
http://www.cnblogs.com/forlina/archive/2011/09/08/2171404.html
http://blog.csdn.net/dhdhdh0920/article/details/5619354
http://www.cesclub.com/bw/jishuzhongxin/Webjishu/2012/0420/28574.html