This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Displaying Message

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic