protected boolean nullOrBlank (String str) { return ((str == null) (str.length() == 0)); } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (nullOrBlank(lastName)) { errors.add("lastName", new ActionError("article1.lastName.missing")); } if (nullOrBlank(firstName)) { errors.add("firstName", new ActionError("article1.firstName.missing")); } if (nullOrBlank(street)) { errors.add("street", new ActionError("article1.street.missing")); } if (nullOrBlank(city)) { errors.add("city", new ActionError("article1.city.missing")); } if (nullOrBlank(state)) { errors.add("state", new ActionError("article1.state.missing")); } if (nullOrBlank(postalCode)) { errors.add("postalCode", new ActionError("article1.postalCode.missing")); } if (nullOrBlank(phone)) { errors.add("phone", new ActionError("article1.phone.missing")); } return errors; }