The CommonsValidator class reads the messages from the application's resource bundle, then from the 'messages' bundle in org.apache.shale.validator (the (localized) messages.properties file inside shale-core.jar).

If you can use one of the provided messages for your validator, then no action is necessary.

If you need to provide additional messages or override any of the provided messages, here's how:

Configure a resource bundle for your application in faces-config.xml. For example:

ATTENTION: There is an issue with client-side validation in conjunction with using a commandButton for wizard-style "back" navigation. You have to remove the "onsubmit" handler from the form and attach it to the normal "next" commandButton ("onclick" handler) instead. Otherwise the client-side validation will be executed in the "back" navigation case, too (which is not wanted in most cases).

Required Validator

The 'required' validator is a special case. The JSF framework will only call a Validator if a value was submitted. Usually, you would set required="true" as an attribute on the input component.

So that you don't have to remember to do something different for 'required', Shale allows <s:validator type="required">, which works by setting the required attribute of the surrounding input component to true.