Class FlashMap

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparable<FlashMap>, Map<String,​Object>

    public final class FlashMap
    extends HashMap<String,​Object>
    implements Comparable<FlashMap>
    A FlashMap provides a way for one request to store attributes intended for use in another. This is most commonly needed when redirecting from one URL to another -- e.g. the Post/Redirect/Get pattern. A FlashMap is saved before the redirect (typically in the session) and is made available after the redirect and removed immediately.

    A FlashMap can be set up with a request path and request parameters to help identify the target request. Without this information, a FlashMap is made available to the next request, which may or may not be the intended recipient. On a redirect, the target URL is known and a FlashMap can be updated with that information. This is done automatically when the org.springframework.web.servlet.view.RedirectView is used.

    Note: annotated controllers will usually not use FlashMap directly. See org.springframework.web.servlet.mvc.support.RedirectAttributes for an overview of using flash attributes in annotated controllers.

    Since:
    3.1
    Author:
    Rossen Stoyanchev
    See Also:
    FlashMapManager, Serialized Form