Questions tagged [flash-scope]

The flash scope is a scope which lives during the redirected request only. This is particularly useful if you want to prepare a request scoped object in the server side before redirecting. The object is then available in the redirected request.

The flash scope is originally a Ruby on Rails invention. It's later been taken over in several other modern web based MVC frameworks like JSF2, Play!, etcetera.

The flash scope is backed by a short living cookie which is associated with a data entry in the session scope. Before the redirect, a cookie will be set on the HTTP response with a value which is uniquely associated with the data entry in the session scope. After the redirect, the presence of the flash scope cookie will be checked and the data entry associated with the cookie will be removed from the session scope and be put in the request scope of the redirected request. Finally the cookie will be removed from the HTTP response. This way the redirected request has access to request scoped data which was been prepared in the initial request.

The flash scope is often used for messaging purposes in case of form submits following the Post-Redirect-GET pattern. As a redirect basically instructs the browser to create a brand new HTTP request, it would not be possible to use the request scope to pass request based data from the controller to the view. The flash scope solves exactly this problem.

53 questions
2
votes
0 answers

Flash Scope does not delete variables

I'm having a problem with Flash Scope when I try to set a flash scope variable and then do a redirect. In the console, I get the following trace... com.sun.faces.context.flash.ELFlash setCookie WARNING: JSF1095: The response was already…
viczap
  • 194
  • 2
  • 12
2
votes
1 answer

Mojarra 2.1.14 flash scope messages and redirect to different path

According to this: http://java.net/jira/browse/JAVASERVERFACES-2136 flash-"scoped" messages should survive a redirect to a page on a different path.. I wanted to use something like this in my application so i downloaded…
luke_leo
  • 55
  • 3
  • 8
2
votes
1 answer

jsf2 flash is living longer that it should?

What i use: RichFaces version v.4.1.0.Final Mojarra 2.0.3 edit: i installed mojarra 2.1.11 So, im facing 2 problems. 1 - I'm going by flash, an object to see it in the next view. The problem is that when a re direct my page through the…
pata
  • 959
  • 2
  • 18
  • 35
1
vote
2 answers

Warning JSF1095 while using a h:commandLink inside a rich:dataTable

I have a h:commandLink inside rich:dataTable. When I click on the command link, I'm adding a FacesMessage to the context and redirecting to the same message. I have a h:messages tag on the page to display any faces messages. I am able to display…
Praneeth
  • 1,457
  • 5
  • 23
  • 36
1
vote
1 answer

ArrayIndexOutOfBoundsException at com.sun.faces.context.flash.ELFlash$PreviousNextFlashInfoManager.decode

I am trying to run a JSF web application on Payara 5.194. The whole application is compiled and runs successfully. But after being deployed it gives an error and doesn't load. I am not able to identify the cause of this error. Warning: …
Nath
  • 57
  • 1
  • 2
  • 7
1
vote
1 answer

Spring FlashScope

While waiting for FlashScope to be integrated into Spring 3.1 (it's scheduled for this release anyways), I came across this bug posting, which allowed me to incorporate a loose version of what should be available once 3.1 comes out. My issue is that…
Scott
  • 9,458
  • 7
  • 54
  • 81
1
vote
1 answer

How does method chaining work in #{flash.keep.message} in Expression Language?

I have this sample code: and in the bean: @ManagedBean @ApplicationScoped public class FooBar { public String foo() { final Flash flash =…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
1
vote
0 answers

Flash data is lost after JSF page reload

I implemented JSF Flash in pages: First page: public void…
FastWalker
  • 23
  • 5
1
vote
0 answers

Keeping flash via #{flash.keep.foo} does not to work, instead #{flash.foo} works

I have an app running with Primefaces, JSF 2.2, Spring and Hibernate. I use JSF's Flash Scope to send a parameter with a redirection: FacesContext.getCurrentInstance().getExternalContext().getFlash().put("loginCliente", cliente.getLogin()); return…
rorbla
  • 23
  • 4
1
vote
0 answers

Flash-Scope in latest Mojarra-versions?

i read many topics with problems about mojarra's flash-scope and until now, i was not able to get completly rid of these annoying "The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored…
Steve
  • 384
  • 1
  • 7
  • 17
1
vote
0 answers

JSF 2.2.4 and Flash com.sun.faces.context.flash.ELFlash getCurrentFlashManager

I'm facing this bug. 5 déc. 2013 13:15:15 com.sun.faces.context.flash.ELFlash getCurrentFlashManager GRAVE: JSF1094: Could not decode flash data from incoming cookie value Invalid characters in decrypted value. Processing will continue, but the…
ZheFrench
  • 1,164
  • 3
  • 22
  • 46
1
vote
1 answer

JSF ui:debug causing NullPointerException

My JSF application has a tag in the top level template. I have a data item creation page that saves the item to the DB. The DB then returns the saved item which I store in the JSF flash. I then redirect to a new page and display the…
mpaulse
  • 87
  • 1
  • 11
1
vote
2 answers

JSF 2.0 Flash-scope - cookie path

I have been struggeling with the Flash-scope (I know it is not a "scope" like the others, but often referred to as one) in JSF 2.0. (Mojarra) My problem is that the flash-cookie is bound to the path of the view putting the object in flash. This…
Nils Otto
  • 611
  • 6
  • 16
0
votes
0 answers

JSF, getting parameters from Flash scope do not work in Internet Explorer

our project is on JSF 2.2 (Mojorra 2.2.0) Servlet 3.0 : Jboss EAP 6.1 Facelets (XHTML) When we put a parameter to Flash , we can not get it from another page in I.E. browser. We tried in I.E. 11 on different machines. Strangely it is ok in Chrome,…
CSekem
  • 33
  • 5