Page 1 of 1

How to add message to another page?

Posted: 10 Apr 2011, 19:14
by kacem
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.

Re: How to add message to another page?

Posted: 10 Apr 2011, 21:08
by Oleg
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.

Re: How to add message to another page?

Posted: 10 Apr 2011, 21:20
by cagatay.civici
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.

Re: How to add message to another page?

Posted: 10 Apr 2011, 21:31
by kacem
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.

Re: How to add message to another page?

Posted: 10 Apr 2011, 21:38
by kacem
That 's it! i will use Flash and keep redirect

problem solved :mrgreen: thank you all.

Re: How to add message to another page?

Posted: 11 Apr 2011, 01:43
by healeyb
Don't expect use of flash to be straightforward, but give it a try.

Re: How to add message to another page?

Posted: 11 Apr 2011, 12:17
by kacem
I'm using right now Flash with redirect and it works like a charm. cheers thank you again!

Re: How to add message to another page?

Posted: 11 Apr 2011, 14:26
by bumble.bee
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/

Re: How to add message to another page?

Posted: 11 Apr 2011, 14:33
by healeyb
>Once it stops working like a charm (as it did for me), then you'll probably >want to take a look here:

me too!

Re: How to add message to another page?

Posted: 11 Apr 2011, 18:19
by kacem
well, if you say so i will look at the link emediatly!