最近我从 struts2.3.35 迁移到 struts2.5.26 并且随之我从使用外部 tomcat 的 spring 迁移到 spring boot 应用程序,现在它使用嵌入式 tomcat。
因此,每当我尝试在动作类上上传文件时,即使我在动作类上有 setter 方法,也会返回 null。
<s:form id="upload" action="upload" theme="simple" method="post" enctype="multipart/form-data">
<fieldset>
<legend><b>Trust File</b></legend>
<table>
<tr>
<td><label for="uploadedFile"><b>Trust File</b></label></td>
<td><s:file name="uploadedFile" id="tobFile" size="30"/></td>
</tr>
<tr>
<td><label for="tobFileSheet"><b>Sheet Name</b></label></td>
<td><s:textfield name="tobFileSheet" id="tobFileSheet" size="30"/></td>
</tr>
<tr>
<td><label for="tobTrustee "><b>Trustee Name</b></label></td>
<td><s:select name="trustee" list="trustees" listValue="value" listKey="value" emptyOption="true" /></td>
</tr>
<tr><td colspan="2"><hr/></td></tr>
<tr>
<td colspan="2" align="right">
<s:url var="submit" value="reports/upload.action"/>
<sj:submit targets="formResults" value="Submit" indicator="indicator"/>
</td>
</tr>
</table>
</fieldset>
</s:form>