I am using Struts2 – FileUploadInterceptor to handle content type and maximum size of the file being uploaded.
In order to display error messages, <s:fielderror/> is displaying error message which is perfect.
I am working on a page which has multiple sections and i need to display error messages belonging only to that section, problem with <s:fielderror/> is that it displays all error messages and to solve this parameters are to be passed, like
<s:fielderror><s:param>firstName</s:param></s:fielderror>
I am not sure what is the error key created by FileUploadInterceptor for content type error and maximum size error, please help me in addressing this issue.
If I understand you correctly, I think you want to do something like this:
so that you can render them separately/differently.
This is currently not possible since
<s:fielderror/>only takes field names.You cannot separate the multiple errors for one field in this way.
Additionally, looking at the source code for the
acceptFilemethod in theFileUploadInterceptor, the max size is checked first and an error is set if that check fails. The code doesn’t continue to check for the allowed types if the max size already failed.So you should only get one of these errors at a time.