I am using struts validator for some feilds on my jsp. I have a action form in which there is a collection (array) as the member variable. I want to make one of member variable of the array class as mandatory. I get a null pointer excetion if the collection (array) is null. I want to stop the validation when the data is null(when the screen is loaded for the first time) Please help Nitin
Initialize your field to a zero-length array, do the same thing in the form's reset() method. To handle the first-time display, I usually check if a specific action came in with the request (I map all my submit buttons to a property called 'action') so my check in validate() is usually: if (action == null) return null; If I have many conditions to check, I'll pull those conditions out to a query method so I can write something like if (skipValidate()) return null;