Page 1 of 1

Multipage and Flash messages

Posted: 16 Apr 2015, 10:25
by hwaastad
Hi,
I have a multipage application, using p:commandbutton action="bean.navigate()" to navigate.

In the bean.navigate I'm adding a global flash message but the message is not displayed in the second view.
It needs a page refresh.

Navigating to a separate page, adding a global flash message it's ok.

Any recommendations are appreciated.

br hw

Re: Multipage and Flash messages

Posted: 19 Apr 2015, 05:57
by smithh032772
please share your primefaces mobile xhtml and this bean.navigate(), too.

Re: Multipage and Flash messages

Posted: 20 Apr 2015, 21:29
by hwaastad
smithh032772 wrote:please share your primefaces mobile xhtml and this bean.navigate(), too.
Hi and thanks for answering.
xhtml code is simple:

Code: Select all

<h:body>
        <p:growl id="messages" autoUpdate="true" globalOnly="true"/>
        <pm:page id="first">
            <pm:header id="header">
                Header
            </pm:header>
            <pm:content id="content">
                <h:form id="form">
                    <p:commandButton value="action" action="#{messageController.addMessage()}"/>
                </h:form>
            </pm:content>
            <pm:footer id="footer">
                Footer
            </pm:footer>
        </pm:page>
        <pm:page id="second">
            <pm:header id="header">
                Header
            </pm:header>
            <pm:content id="content">
                Contant Page 2
            </pm:content>
            <pm:footer id="footer">
                Footer
            </pm:footer>
        </pm:page>
    </h:body>
And the controller:

Code: Select all

public String addMessage() {
        log.info("Adding message");
        Messages.addFlashGlobalInfo("A Flash message");
        return "pm:second";
    }
Messages is an omnifaces utility.
Does'nt really matter where I put the growl, it's not shown.

A sample project is here:
https://github.com/hwaastad/MobileMessages.git

just do a mvn tomee:run and it's deployed on ROOT.


br hw

Re: Multipage and Flash messages

Posted: 23 Apr 2015, 15:51
by kukeltje
I never used flash scope, but from what I read it is used to have messages survive a jsf http page redirect. The Mobile pages work differently and a normal message should suffice.

Re: Multipage and Flash messages

Posted: 25 Apr 2015, 16:53
by hwaastad
kukeltje wrote:I never used flash scope, but from what I read it is used to have messages survive a jsf http page redirect. The Mobile pages work differently and a normal message should suffice.
Hi,
yes that's what I would expect, but still creating a normal facesmessage, growl still is not showing.

br hw

Re: Multipage and Flash messages

Posted: 26 Apr 2015, 12:48
by kukeltje
Then create a new topic with a new example. works for me

Re: Multipage and Flash messages

Posted: 28 Apr 2015, 15:42
by hwaastad
kukeltje wrote:Then create a new topic with a new example. works for me
Hi,
Yes, I'll make another topic.

br hw

Re: Multipage and Flash messages

Posted: 06 Jul 2015, 09:58
by GeorgeMelchers
I read it is used to have messages survive a jsf http page redirect.

Re: Multipage and Flash messages

Posted: 07 Jul 2015, 17:38
by kukeltje
Yes, but mobile multipage is not using redirects