public void validate(Form<?> form) { // only validate on final submit if (form.findSubmittingButton() != form.get("submit")) { return; } // Getting pool components final Component maxPoolComponent = form.get("maxPoolSize"); final Component corePoolComponent = form.get("corePoolSize"); int maxPool; int corePool; // checking limits are properly set if (maxPoolComponent != null && maxPoolComponent instanceof TextField<?> && corePoolComponent != null && corePoolComponent instanceof TextField<?>) { final TextField maxPoolField = (TextField) maxPoolComponent; final TextField corePoolField = (TextField) corePoolComponent; final String mp = maxPoolField.getValue(); final String cp = corePoolField.getValue(); if (!(mp == null || cp == null || mp.trim().isEmpty() || cp.trim().isEmpty())) { try { maxPool = Integer.valueOf(mp); } catch (NumberFormatException nfe) { // The MinimumValidator(1) should already deal with that return; } try { corePool = Integer.valueOf(cp); } catch (NumberFormatException nfe) { // The MinimumValidator(1) should already deal with that return; } if (maxPool >= 1 && corePool >= 1 && maxPool < corePool) { form.error(new ParamResourceModel("poolSizeCheck", getPage()).getString()); } } } }