}
public static int getRequiredIntRequestParameter(ServletRequest request, String name) {
String value = getRequiredRequestParameter(request, name);
if (value.length() == 0) {
throw new ParameterNotFoundException("Required request parameter '" + name + "' has an empty value.");
}
int intValue;
try {
intValue = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new ParameterNotFoundException("Request parameter '" + name + "' has value '" + value
+ "', which is not a valid integer.");
}
return intValue;
}