Is it possible to load p:growl when the page is load

UI Components for JSF
Post Reply
KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

04 Nov 2010, 21:04

When the load a page, the init() method with @PostConstruct check certain parameter. If something wrong, I will send a FacesMessage. But I cant get p:growl to load that FacesMessage. Is it possible?

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

05 Nov 2010, 14:51

You might want to use the preRenderView system event of JSF 2 to do something before a page is rendered.

I don't think the @PostConstruct will always get called every time the page loads. In the event the bean has a scope that spans multiple requests there may only be one time when it is callled. I believe the method annotated with @PostConstruct is called right after the bean has objects injected.

Put a System.out.println in your @PostConstruct method and see when it is getting called.


justus
Posts: 48
Joined: 30 Dec 2011, 16:37

18 Jun 2012, 16:03

Hey Cagthay.
Where's the bean(s) for the mac demo from the above link? The xhtml source is included in the demo, but I was looking for the backing bean. Specifically I was looking for the growl on page load implementation.
3.3.1
WebSphere 7
Mojarra 2.0.4

From another forum member:
I've just fixed the problem on IE7...
I personally hate IE7 with all my heart but still need to support it for some time.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

18 Jun 2012, 16:11

Checkout showcase to get all the source;

Code: Select all

svn co https://primefaces.googlecode.com/svn/examples/trunk/showcase primefaces-showcase

justus
Posts: 48
Joined: 30 Dec 2011, 16:37

18 Jun 2012, 16:34

Yeah sorry about that. I forgot. The problem I have is that I am behind a proxy at work that I have zero influence over or information of. So I have to go through with firebug and accept many or most of the 407's in a separate tab then reload the page. I could pull the code base if I could install tortoise (without filing a bunch of forms I can't). Not your fault, but it is easier for me if the information I am looking for is displayed like in the showcase. Speaking of which, thanks for having a show case. That helps a lot.

To clarify I was able to view the backing bean for the macosx showcase by opening all the js dependencies in another tab first then reloading the original page.
3.3.1
WebSphere 7
Mojarra 2.0.4

From another forum member:
I've just fixed the problem on IE7...
I personally hate IE7 with all my heart but still need to support it for some time.

ceng
Posts: 14
Joined: 20 Jul 2012, 14:18

26 Jul 2012, 10:32

optimus.prime wrote:Live sample;

http://www.primefaces.org/showcase/ui/macosx.jsf
I looked over the source of the page:

<p:growl showDetail="true" sticky="true"/>

public class MacosxBean {

private String text;

public MacosxBean() {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Software Update", "New version of iTunes is available"));
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Software Update", "New version of PrimeFaces is available"));
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}
}

There isn't an id of growl, there isn't update="growlIDxxx" to trigger the growl. How is it possible to load growl when the page is load?


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 55 guests