Class FlashScope


  • public class FlashScope
    extends Object
    Flash Scope allows one request to pass data to the next request if it's a redirect.

    FlashScope only becomes available if the redirect action result is specified as "redirectwithflash" (check struts.xml) In a REST request, need to call persist() and getFlashScopeUrl(String, String) to persist and build the URL that supports FlashScope

    • Constructor Detail

      • FlashScope

        public FlashScope()
    • Method Detail

      • put

        public static void put​(String key,
                               Object value)
        Adds things to the FlashScope. They will be available to the request after the current one.
      • get

        public static Object get​(String key)
        Retrieves FlashScope items stored in the previous request
      • has

        public static boolean has​(String key)
        Returns:
        true if FlashScope item was stored in the previous request
      • getFlashScopeUrl

        public static String getFlashScopeUrl​(String url,
                                              String flashId)
        Decorate an URL with FlashScope information. The next request with the decorated URL will have access to FlashScope values. Mainly for use inside REST requests. Inside an XWork request, see RedirectWithFlashResult
        Parameters:
        url - a normal url without FlashScope information yet
        flashId - FlashScope information
        Returns:
        decorated url which carries the FlashScope information