Class MessagesPerFieldBean


  • public class MessagesPerFieldBean
    extends Object
    Bean used to hold form messages per field. Stored under messagesPerField key in Freemarker context.
    Author:
    Vlastimil Elias (velias at redhat dot com)
    • Constructor Detail

      • MessagesPerFieldBean

        public MessagesPerFieldBean()
    • Method Detail

      • exists

        public boolean exists​(String field)
        Check if message for given field exists
        Parameters:
        field -
        Returns:
      • existsError

        public boolean existsError​(String... fields)
        Check if exists error message for given fields
        Parameters:
        fields -
        Returns:
      • getFirstError

        public String getFirstError​(String... fields)
        Get first error message for given fields
        Parameters:
        fields -
        Returns:
        message text or empty string
      • get

        public String get​(String fieldName)
        Get message for given field.
        Parameters:
        fieldName -
        Returns:
        message text or empty string
      • printIfExists

        public String printIfExists​(String fieldName,
                                    String text)
        Print text if message for given field exists. Useful eg. to add css styles for fields with message.
        Parameters:
        fieldName - to check for
        text - to print
        Returns:
        text if message exists for given field, else empty string