在我struts.xml中我有:覆蓋Struts 2個的消息
<action name="file_save" method="fileSave" class="FileActionBean">
<interceptor-ref name="fileUpload">
<param name="maximumSize">
5242880
</param>
<param name="allowedTypes">
text/html
</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<result name="success" type="redirect">file</result>
<result name="error">error</result>
</action>
當我上傳的文件是大於5MB則不會引發錯誤。然後在我的struts.xml頂我:
<constant name="struts.multipart.maxSize" value="20971520" />
現在,當我上傳的文件的大小超過20MB則顯示錯誤信息更大。這是正常的行爲嗎?
如果是這樣,我怎麼配置struts來顯示攔截器的錯誤信息呢?
編輯1:
我使用Struts 2的版本2.1.8.1
似乎全球conf覆蓋其他。 – Jaiwo99
是的,這是正確的。通過遵循上一個鏈接,我也解決了這個問題。 – ThreaT