- java.lang.Object
- 
- org.omnifaces.validator.JsfLabelMessageInterpolator
 
- 
- All Implemented Interfaces:
- MessageInterpolator
 
 public class JsfLabelMessageInterpolator extends Object implements MessageInterpolator Unlike native Faces validation error messages, in a bean validation message by default the label of the component where a validation constraint violation originated from can not be displayed in the middle of a message. Using the jakarta.faces.validator.BeanValidator.MESSAGEbundle key such label can be put in front or behind the message, but that's it. With thisJsfLabelMessageInterpolatora label can appear in the middle of a message, by using the special placeholder{jsf.label}in bean validation messages.Note that Bean Validation is not only called from within Faces, and as such Faces might not be available. If Faces is not available occurrences of {jsf.label}will be replaced by an empty string. The user should take care that messages are compatible with both situations if needed.This message interpolator is not needed for putting a component label before or after a bean validation message. That functionality is already provided by Faces itself via the jakarta.faces.validator.BeanValidator.MESSAGEkey in any resource bundle known to Faces.InstallationCreate a /META-INF/validation.xmlfile in WAR with the following contents:<?xml version="1.0" encoding="UTF-8"?> <validation-config xmlns="https://jakarta.ee/xml/ns/validation/configuration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/validation/configuration https://jakarta.ee/xml/ns/validation/validation-configuration-3.0.xsd" version="3.0" > <message-interpolator>org.omnifaces.validator.JsfLabelMessageInterpolator</message-interpolator> </validation-config>UsageAs an example, the customization of @SizeinValidationMessages.properties:jakarta.validation.constraints.Size.message = The size of {jsf.label} must be between {min} and {max} characters- Since:
- 1.5
- Author:
- Arjan Tijms
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface jakarta.validation.MessageInterpolatorMessageInterpolator.Context
 
- 
 - 
Constructor SummaryConstructors Constructor Description JsfLabelMessageInterpolator()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringinterpolate(String messageTemplate, MessageInterpolator.Context context)Stringinterpolate(String messageTemplate, MessageInterpolator.Context context, Locale locale)
 
- 
- 
- 
Method Detail- 
interpolatepublic String interpolate(String messageTemplate, MessageInterpolator.Context context) - Specified by:
- interpolatein interface- MessageInterpolator
 
 - 
interpolatepublic String interpolate(String messageTemplate, MessageInterpolator.Context context, Locale locale) - Specified by:
- interpolatein interface- MessageInterpolator
 
 
- 
 
-