Apache%20Wicket%20Interview%20Questions%20and%20Answers
Question: How to keep file validation in apache-wicket if no file has been selected?Answer:To fix it, just override the validateOnNullValue() method like this : FileUploadField fileUpload = new FileUploadField("fileupload",new Model<FileUpload>()); fileUpload .add(new AbstractValidator() { public boolean validateOnNullValue(){ return true; } protected void onValidate(IValidatable validatable) { FileUpload fileUpload = (FileUpload) validatable.getValue(); } protected String resourceKey() { return "yourErrorKey"; } }); Now, when no file is selected, and submit button is clicked, validation will be performed. |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is Wicket Framework?
- What are Wicket Models?
- What is Base class for HTML pages?
- What are the Ways to create a page in wicket?
- How to integrate apache-wicket with Spring?