• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying Message

 
Jack pero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a scnerio in which when i click on logout button on any page, it should take me to the login page with a message -"You successfully logged out".
What i did for this is, in my managed bean, for logout method i added :

facesContext.addMessage("loginform:logoutMessage", new FacesMessage("Logged Out"));

where loginform is form id.

And in the JSF page i added:
<t:message for="logoutMessage" style="color: red"/>

But still i am unable to display the message at the time of logout, can anyone please check if i am going fine.

thanks,
jack
 
rajani varma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jack,
I did something similar to this. In the login.jsp page the code should be,


The "info" is in styleSheet.
and also save the state of boolean variable in login.jsp,



and in the managed bean, declare a boolean variable and handle the infoMessage in the logout method. For eg.



I think you can do this without boolean variable also. But I am not sure. I used the flag because I had different scenarios to display the message.
Hope this helps....

-Rajani.
 
Jack pero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajani,
Thanks alot for your kind help. I also tried the same thing, but it worked without using flag.
Thanks again for your useful help.

-Jack
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!