I have a simple form with a bunch of fields. each of them is required, and each has a different name:
when the form is submi
Either use requiredMessage
attribute
Or use label
attribute and supply a custom required message template.
with a CustomMessages.properties
in the classpath which contains the custom message template
javax.faces.component.UIInput.REQUIRED = {0} is required.
The {0}
will be substituted with the value of the label
attribute. You can find an overview of all keys in the JSF specification (e.g. JSF 2.0 spec - chapter 2.5.2.4). Declare the message properties file in faces-config.xml
as message-bundle
:
com.example.CustomMessages
(assuming that it's in the package com.example
, you can name it whatever you want)
For more message template keys, check the JSF specification.