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 Summary

      Constructors 
      Constructor Description
      AlertTag()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAlertToRequest​(org.springframework.web.servlet.ModelAndView modelAndView, java.lang.String message)
      Adds the message as an Alert with type=AlertType.INFO to the current modelAndView.
      static void addAlertToRequest​(org.springframework.web.servlet.ModelAndView modelAndView, java.lang.String message, AlertType alertType)
      Adds the message as an Alert with the given alertType to the current modelAndView.
      void doTag()  
      • Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport

        findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlertTag

        public AlertTag()
    • Method Detail

      • addAlertToRequest

        public static void addAlertToRequest​(org.springframework.web.servlet.ModelAndView modelAndView,
                                             java.lang.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,
                                             java.lang.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,
                          java.io.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
        java.io.IOException