private void numberCheck(String field, String numText, boolean rangeCheck,
int min, int max) {
// Check for 'is required'
if ((numText == null) || (numText.length() < 1)) {
errors.add(field, new ActionError("error."+field+".required"));
} else {
// check for 'must be a number' in the 'valid range'
try {
int num = Integer.parseInt(numText);
// perform range check only if required
if (rangeCheck) {
if ((num < min) || (num > max ))
errors.add( field,
new ActionError("error."+ field +".range"));
}
} catch (NumberFormatException e) {
errors.add(field,
new ActionError("error."+ field + ".format"));
}
}
}