How to add message to another page?

UI Components for JSF
Post Reply
kacem
Posts: 9
Joined: 10 Apr 2011, 18:53

10 Apr 2011, 19:14

Hi guys, I just started using PrimeFaces it's been a while, and it's so cool, however I can't figure out how to solve a situation let's say :

I have 2 pages listCustomers.jsf and newCustomer.jsf, I'm using newCustomer.jsf to add new customer, and if it is added succefully i need to show a message dialog in a growl in the next page "listCustomers.jsf" telling that the customer has been succefuly added... , however I can't do that since messages are added to the current page "newCustomer.jsf", so is there any way to send the message to the next page?

best regards.
Primefaces 2.2.1
JSF 2.0 Mojarra 2.0.2
Facelets
GlassFish 3.0.1

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

10 Apr 2011, 21:08

Hi,

Do you do a redirect to listCustomers.jsf? Why can you not add messages to listCustomers.jsf? If it's quite normally forward navigation and you have messages tag in listCustomers.jsf, you should see the messages there.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

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

10 Apr 2011, 21:20

Yes, if you do a forward, messages can be displayed in new page, if you do redirect they are gone. If I'm not mistaken, JSF 2's new Flash feature has keepMessages option to survive messages in redirects.

kacem
Posts: 9
Joined: 10 Apr 2011, 18:53

10 Apr 2011, 21:31

Thank you for fast replay, and in fact i'm doing redirect , I guess that's why i can't get messages in the next page i will try this out right now and confirm it.
Primefaces 2.2.1
JSF 2.0 Mojarra 2.0.2
Facelets
GlassFish 3.0.1

kacem
Posts: 9
Joined: 10 Apr 2011, 18:53

10 Apr 2011, 21:38

That 's it! i will use Flash and keep redirect

problem solved :mrgreen: thank you all.
Primefaces 2.2.1
JSF 2.0 Mojarra 2.0.2
Facelets
GlassFish 3.0.1

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

11 Apr 2011, 01:43

Don't expect use of flash to be straightforward, but give it a try.

kacem
Posts: 9
Joined: 10 Apr 2011, 18:53

11 Apr 2011, 12:17

I'm using right now Flash with redirect and it works like a charm. cheers thank you again!
Primefaces 2.2.1
JSF 2.0 Mojarra 2.0.2
Facelets
GlassFish 3.0.1

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

11 Apr 2011, 14:26

Once it stops working like a charm (as it did for me), then you'll probably want to take a look here:

http://ocpsoft.com/java/persist-and-pas ... redirects/

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

11 Apr 2011, 14:33

>Once it stops working like a charm (as it did for me), then you'll probably >want to take a look here:

me too!

kacem
Posts: 9
Joined: 10 Apr 2011, 18:53

11 Apr 2011, 18:19

well, if you say so i will look at the link emediatly!
Primefaces 2.2.1
JSF 2.0 Mojarra 2.0.2
Facelets
GlassFish 3.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests