• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

h:messages for components only.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

How can I display messages releated to all components on a page (not global messages) with just one JSF tag? Is it possible?

I want to place such tag on the page top, but I don't need global messages.

Thanks in advance.
Oleg.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
still you can use h:messages tag.
For example, How can I show a confirmation message after successfully persist data in database/ or a business validation message.

Java side code:
FacesContext context = FacesContext.getcurrentInstance();
context.addMessage(null, MessageUtils.getMessage(context, "Deatils saved successfully"); // we are passing component id as null here.

In UI:

<h:messages layout="table"/>

Dont specify "for" attribute here. It will show all the messages.
 
Oleg Varaksin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

But I don't want all messages. I want to dispaly only component related messages which were created with



And I want to do that with just one JSF tag. Well, I already know it doesn't work. I think, I must iterate over FacesConfig.getClientIdsWithMessages() and pass each Id into the h:message for-attribute.

Best regards.
Oleg.
 
Sridhar Ponnusam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok. Did you try using "globalOnly" attribute of h:messages tag. true/false.



 
Oleg Varaksin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I tried it. It didn't help.
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic