1 Reply Latest reply on Feb 17, 2009 5:51 AM by Aleksander Frontczak

    rich:messages - custom messages configuration

    Aleksander Frontczak Newbie

      Hi,

      I am trying to configure custom messages for rich:messages component.
      As example let's consider input field with requred=true.
      As generic validation message I get:
      <required_component_label>: Validation Error: Value is required.

      I need to show localized message and without "Validation Error:" string.
      When I add to my message bundle:
      javax.faces.component.UIInput.REQUIRED
      I get:
      <my string from message bundle>
      It's still not satisfacting because I need to point to field which caused validation message ("<required_component_label>: " string).

      I tried to set requiredMessage attribute, but EL expression which works fine in other places in this page
      seem not to be working as this attribute value.
      I have declared message bundle as following:
      <f:loadBundle basename="voting_ext" var="extMsg" />
      For exaple I tried to set requiredMessage as following:
      requiredMessage="#{genMsg['general.name']}: #{genMsg['general.validation.message.required']}"
      but I got only ": " string.

      Has anyone found solution for it?

      greetings,
      Alexander

        • 1. Re: rich:messages - custom messages configuration
          Aleksander Frontczak Newbie

          I found description with the solution.
          In message bundle default entries for validation messages parameters can be used. e.g.:
          javax.faces.component.UIInput.REQUIRED={0}: field required
          javax.faces.converter.IntegerConverter.INTEGER={2}: must be a number
          javax.faces.converter.DoubleConverter.DOUBLE={2}: must be a number
          javax.faces.converter.BooleanConverter.BOOLEAN={2}: must be 'true' or 'false'
          javax.faces.converter.NumberConverter.NUMBER={2}: must be a number
          javax.faces.converter.NumberConverter.PERCENT={2}: must be percent value

          greetings,
          Alexander