Multipage and Flash messages

UI Components for JSF
Post Reply
hwaastad
Posts: 56
Joined: 11 Oct 2010, 12:43

16 Apr 2015, 10:25

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

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

19 Apr 2015, 05:57

please share your primefaces mobile xhtml and this bean.navigate(), too.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

hwaastad
Posts: 56
Joined: 11 Oct 2010, 12:43

20 Apr 2015, 21:29

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

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

23 Apr 2015, 15:51

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.

hwaastad
Posts: 56
Joined: 11 Oct 2010, 12:43

25 Apr 2015, 16:53

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

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

26 Apr 2015, 12:48

Then create a new topic with a new example. works for me

hwaastad
Posts: 56
Joined: 11 Oct 2010, 12:43

28 Apr 2015, 15:42

kukeltje wrote:Then create a new topic with a new example. works for me
Hi,
Yes, I'll make another topic.

br hw

GeorgeMelchers
Posts: 2
Joined: 02 Jul 2015, 09:34

06 Jul 2015, 09:58

I read it is used to have messages survive a jsf http page redirect.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

07 Jul 2015, 17:38

Yes, but mobile multipage is not using redirects

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests