问题
Adding the following the to struts.xml in struts2.3.24:
<constant name="struts.multipart.parser" value="jakarta-stream" />
<constant name="struts.multipart.maxSize" value="3147483648" />
For reference the upload works as follows in the jsp:
<s:form id="uploadData" action="abc_UploadAction?method=Upload" namespace="xyz" validateFields="false" method="post" enctype="multipart/form-data">
For action mapping we use the concept of DMI. The action configuration is as follows:
<action name="abc_*" class="ABCAction">
<result type="chain">invoke_${module}_{1}_${method}</result>
</action>
But file upload still not working for large files of greater than 2gb. But the above code works fine for lesser size uploads,
回答1:
Why are you declaring a bean, if the documentation is not telling you to do so ?
Just change
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakartaStream"
class="org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest"
scope="default" />
<constant name="struts.multipart.parser" value="jakartaStream" />
to the right configuration that should be (hyphenized, not capitalized):
<constant name="struts.multipart.parser" value="jakarta-stream" />
来源:https://stackoverflow.com/questions/34715137/after-migration-to-struts-2-3-24-file-upload-still-not-supported-for-greater-th