JSF doesn’t support cross-field validation, is there a workaround?

The easiest custom approach I’ve seen and used as far is to create a <h:inputHidden> field with a <f:validator> wherein you reference all involved components as <f:attribute>. If you declare it before the to-be-validated components, then you can obtain the submitted values inside the validator by UIInput#getSubmittedValue(). E.g. <h:form> <h:inputHidden id=”foo” value=”true”> <f:validator validatorId=”fooValidator” /> … Read more

Cross field validation with Hibernate Validator (JSR 303)

Each field constraint should be handled by a distinct validator annotation, or in other words it’s not suggested practice to have one field’s validation annotation checking against other fields; cross-field validation should be done at the class level. Additionally, the JSR-303 Section 2.2 preferred way to express multiple validations of the same type is via … Read more

Which characters make a URL invalid?

In general URIs as defined by RFC 3986 (see Section 2: Characters) may contain any of the following 84 characters: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;= Note that this list doesn’t state where in the URI these characters may occur. Any other character needs to be encoded with the percent-encoding (%hh). Each part of the URI has further restrictions about … Read more