Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7408929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:59:45+00:00 2026-05-29T05:59:45+00:00

I have a misunderstanding with the use of flash scope in jsf 2. I

  • 0

I have a misunderstanding with the use of flash scope in jsf 2.
I want to put an object in flash map during my action and show this object in the next page.
Here is my action (call by h:commandLink):

public String showDetail(PersonneDTO personne) {
    MessageFlashBean message = new MessageFlashBean();
    message.addMessage("test");
    FacesContext.getCurrentInstance().getExternalContext().getFlash()
        .put("test", message);
    return "showDetail";
}

It’s just a test, but the real object I want to use is more complex.

Here is the second page with the flash use:

<ui:fragment rendered="#{flash.test != null and flash.test.hasMessage()}" >
    <ui:repeat var="message" value="#{flash.test.messages}">
        #{message}
    </ui:repeat>
</ui:fragment>

Here is the navigation (and here is my problem 🙂 ):

<navigation-rule>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>showDetail</from-outcome>
        <to-view-id>/private/showDetail.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

In this case, the flash scope works fine and my message appears.

But if I add a redirect in the navigation case, my object in the flash map has disappeared.

I don’t understand why I can’t use redirect in the navigation rule (I believed it was the goal of flash scope).

May be something is wrong in my code.

Someone can help me ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:59:46+00:00Added an answer on May 29, 2026 at 5:59 am

    The Mojarra’s implementation of the JSF2 Flash scope had a lot of problems. Most of them were resolved with every new Mojarra release. Currently, with the latest Mojarra version, the 2.1.6, there’s as far as I know still only one major open problem: it won’t work if you redirect to a different base path. See also the (currently) last comment in the long discussion in issue 1751.

    Right now, you have basically the following options:

    1. Forget using Flash when you need to redirect to a different base path. Use a request parameter instead or try to simulate the flash scope with a custom cookie.

    2. If possible, reorganize the folder structure so that you don’t need to redirect to a different base path when you need the flash scope to survive.

    3. Try MyFaces instead of Mojarra. Maybe it does it better with regard to flash scope.


    Update: as per issue 2136, the last open problem of Flash scope not being available after a redirect on a different path is solved in the shortly upcoming Mojarra 2.1.14. So with this version, all Flash scope related problems discovered and open so far
    should be solved and closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a misunderstanding problem with this use of Linq Query I do have
I have a misunderstanding of how to use maven provided scope and the Java
this question can create a misunderstanding: I know I have to use CSS to
This is probably a simple misunderstanding on my part. Have a simple interface: public
have written this little class, which generates a UUID every time an object of
I may have some misunderstanding regarding the use of the UINavigationControllerDelegate protocol. Here is
I have a bit of data that I want to use to build a
I have written a database class(es) sometime ago, I use this for most projects
Why doesn't this UIView layout code work as I want? Background: I have a
I have a misunderstanding regarding this code - typedef struct _EXP{ int x; char*

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.