I have a field of type MultipartFile in a bean base that is attached to a Spring form (I'm using MultipartFilter ),
<form:form htmlEscape="false" action="${pageContext.request.contextPath}/admin_side/Category.htm" id="dataForm" name="dataForm" method="post" commandName="categoryBean" enctype="multipart/form-data"> <input type="file" id="txtCatImage" name="txtCatImage"/> </form:form>
Bean Support,
final public class CategoryBean { private MultipartFile txtCatImage=null; public MultipartFile getTxtCatImage() { return txtCatImage; } public void setTxtCatImage(MultipartFile txtCatImage) { this.txtCatImage = txtCatImage; } }
I tried applying annotations like @NotEmpty , but didn't work. They ended the exception.
javax.validation.UnexpectedTypeException: validator could not be found for type: org.springframework.web.multipart.MultipartFile
I am using Validation-API 1.0.0. Is it possible to check if the user does not download the file and does not press the submit button using the HibernateValidator ?
source share