Class AlertTag

  • All Implemented Interfaces:
    javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

    public class AlertTag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
    Is used to render messages from any controller in the ui. Another word for alert could be notification, message, information. The tag is used to inform the user e.g. about successful operations.
    • Constructor Detail

      • AlertTag

        public AlertTag()
    • Method Detail

      • addAlertToRequest

        public static void addAlertToRequest​(org.springframework.web.servlet.ModelAndView modelAndView,
                                             String message)
        Adds the message as an Alert with type=AlertType.INFO to the current modelAndView.
        Parameters:
        modelAndView - The request where to save the alert in.
        message - The alert message (e.g. Download successful)
      • addAlertToRequest

        public static void addAlertToRequest​(org.springframework.web.servlet.ModelAndView modelAndView,
                                             String message,
                                             AlertType alertType)
        Adds the message as an Alert with the given alertType to the current modelAndView.
        Parameters:
        modelAndView - the request where to save the alert in.
        message - The alert message (e.g. Download failed)
        alertType - The alert type (e.g. AlertType.ERROR)
      • doTag

        public void doTag()
                   throws javax.servlet.jsp.JspException,
                          IOException
        Specified by:
        doTag in interface javax.servlet.jsp.tagext.SimpleTag
        Overrides:
        doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
        Throws:
        javax.servlet.jsp.JspException
        IOException