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 4576332
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:11:26+00:00 2026-05-21T20:11:26+00:00

I have a simple flow in my appliaction – if you fill out and

  • 0

I have a simple flow in my appliaction – if you fill out and press save on one form (if everything goes well) you are redirected to a second view with a list. Now I wanted to add a message saying “You successfuly added an object” but since I’m using a redirect from what I remember I need to use the Flash scope. And so I did. The problem is that during the first “save” it correctly shows only 1 message but when I navigate back to the form and hit “save” it will show me the current message and the old one! It’s even stranger that when (for the 3rd time) I go back to the form and hit “save” I again get only 1 message (and so on 1-2-1-2-1-2 etc…). Am I doing something wrong or is it a bug in jsf? I mean my I’m calling the same method and get different results…

I’m using primefaces and the newest mojarr:

jsf-api-2.1.1-b04

jsf-impl-2.1.1-b04

primefaces-2.2.1

Here’s the code (most relevant parts at least):

SaveForm.xhtml:

    <div id="content-box" class="content-box">
        <p:panel id="content-panel" header="Dane raportu"
            styleClass="content-panel">
            <div class="content-box">
                <h:form prependId="false">
                    <h:panelGrid id="grid" columns="2" styleClass="content-panel">

                        <!-- some inputs and labels -->

                        <p:commandButton value="#{msg['thesis.save.button']}"
                            action="#{thesisBean.saveThesis}" />    
                    </h:panelGrid>
                </h:form>
            </div>
        </p:panel>
    </div>

saveThesis method:

public String saveThesis() {
            //this creates a Hibernate entity and saves it to the DB
    thesisService.addThesis(createThesisEntity());

    FacesContext context = FacesContext.getCurrentInstance();
    context.getExternalContext().getFlash().setKeepMessages(true);
    ResourceBundle bundle = context.getApplication().getResourceBundle(
            context, "msg");

    context.addMessage(null,
            new FacesMessage(FacesMessage.SEVERITY_INFO, "key1",
                    "key2"));


    return "list-theses.xhtml?faces-redirect=true";
}

list-theses.xhtml:

<ui:composition template="/basicTemplate.xhtml">

<ui:define name="content">

    <p:growl id="growl" showDetail="true" sticky="false" life="5000" />

    <div id="content-box" class="content-box">
        <h:form prependId="false" id="table-form">
            <p:dataTable var="thesis" value="#{thesisTableBean.theses}"
                paginator="true" rows="20">

                <p:column styleClass="table-name-column">
                    <f:facet name="header">
                        <h:outputText value="#{msg['thesis.table.name.header']}" />
                    </f:facet>
                    <h:outputText value="#{thesis.firstName} #{thesis.lastName}" />
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg['thesis.table.title.header']}" />
                    </f:facet>
                    <h:outputText value="${thesis.title}" />
                </p:column>

                <p:column styleClass="table-number-column">
                    <f:facet name="header">
                        <h:outputText value="#{msg['thesis.table.number.header']}" />
                    </f:facet>
                    <h:outputText value="${thesis.number}" />
                </p:column>

            </p:dataTable>

        </h:form>

    </div>

</ui:define>

  • 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-21T20:11:26+00:00Added an answer on May 21, 2026 at 8:11 pm

    Well I found a “solution” here: http://ocpsoft.com/java/persist-and-pass-facesmessages-over-page-redirects/ Seems to work pretty well. Still I have no idea why my code isn’t working. I mean it’s the same method every time but the result differs…

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

Sidebar

Related Questions

I have a simple flow: A.html -> B.html -> C.html Now, page B either
I have simple php validation form that is halfway working. If you leave the
I have simple database - one table with 6 collumns. 3 of them i
I have a simple question. I am working out a simple application with few
In a Struts 1.x application, I have a form with a simple single-selection html:select
I have pretty simple application with text entry and button. When user press on
I have a simple Spring web flow application created. When the application starts, I
I have a data flow task that extracts data from one database and inserts
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple class with width and height member fields which define number of

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.