Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Apache Wicket Interview Questions and Answers

Ques. How to keep file validation in apache-wicket if no file has been selected?
Ans.
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:

©2019 WithoutBook