Skip to main content

Flash scope issue

4 replies [Last post]
laliluna
Offline
Joined: 2005-10-11
Points: 0

Hello,
I used the flash scope the following way:
the page

#{flash['wizardId']}

the bean sending the user to the same page using a redirect
@ManagedBean
public class WizardBean {
public String start(){
FacesContext.getCurrentInstance().getExternalContext().getFlash().put("wizardId", 4711);
return "wizardstart?faces-redirect=true";
}

}

My expected behaviour is:
Flash value is printed on the next page. A reload of the page let it disappear.
This happens as expected but the next reload shows the value again and then the flash value finally disappears with the next reload.

I have 3 questions:
Is the flash scope a mummy flash scope which comes to live again?
Did I misunderstood how to use it?
Why is the flash scope not saved in the session instead of creating another cookie?

Best Regards
Sebastian Hennebrueder
http://www.laliluna.de

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ed Burns

>>>>> On Fri, 23 Oct 2009 06:54:04 -0700 (PDT), webtier@javadesktop.org said:

SH> Hello,
SH> I used the flash scope the following way:
SH> the page

[...]

SH> I have 3 questions:
SH> Is the flash scope a mummy flash scope which comes to live again?

Probably not.

SH> Did I misunderstood how to use it?

You are using it correctly.

I have verified that your scenario works as expected with the latest svn
HEAD of mojarra. I fixed a bug in the flash yesterday, so perhaps with
more recent code your problem will be resolved.

The war I used is at
.

Deploy and visit http://localhost:8080/jsf-flash/faces/flash12.xhtml

SH> Why is the flash scope not saved in the session instead of creating
SH> another cookie?

One use-case for the flash was for those users that didn't want to
pollute the session at all. Therefore, my implementation lives in
Application scope and is designed to prune itself regularly using an LRU
scheme.

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

laliluna
Offline
Joined: 2005-10-11
Points: 0

I understand the solution but you are breaking clustering. I don't think that this is wisely choosen. At least it should be configurable.

Now, I understood why I found this interesting cookie code ;-)

I am busy at the moment but will test the scope as soon as possible.

Best Regards

Sebastian Hennebrueder

arjan_t
Offline
Joined: 2010-06-01
Points: 0

> I understand the solution but you are breaking
> clustering. I don't think that this is wisely
> choosen. At least it should be configurable.
>
> Now, I understood why I found this interesting cookie
> code ;-)

With both the application scope + cookie and session scope approach, wouldn't there be a problem if the user happens to (rapidly) click on two pages that use the flash scope in different tabs or windows?

I could easily see this leading to all sorts of awkward race conditions, with the wrong results appearing on the wrong page. Can't the redirect simply send some ID along that the code behind the flash implementation can use to pick the right data from whatever scope?

Ed Burns

>>>>> On Fri, 23 Oct 2009 06:54:04 -0700 (PDT), webtier@javadesktop.org said:

WT> Hello,
WT> I used the flash scope the following way:
WT> the page

I see this email and will respond to it today.

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net