Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 843159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:04:49+00:00 2026-05-15T06:04:49+00:00

My Objective is to use h:messages to convey user – error and confirmation messages.

  • 0

My Objective is to use h:messages to convey user – error and confirmation messages. The CSS styles to show these two different messages are different, In fact I would like to use an image beside the confirmation message.

e.g. :

<tr>
    <td>
        <img/>
    </td>
    <td>
        <h:msg>
    </td>
</tr>

So I tried to add messages to the Faces Context based on 2 different client ids

<tr>
    <td height="5">
        <h:messages style="color:darkred" id="error_message" />
    </td>
</tr>

<tr>
    <td width="89%" class="InfoMsg" align="center">
        <h:messages id="confirm_message" />
    </td>
</tr>

And the java layer:

FacesMessage facesMessage = new FacesMessage(Constants.saveMessageConfirm);

FacesContext.getCurrentInstance().addMessage(Constants.STATIC_CONFIRM_MSG_CLIENT_ID, facesMessage); 

But, even if I add messages to clientId confirm_message – and only to confirm_message – and not to error_message – The message is shown twice in 2 different styles (refer the HTML above).

2 Questions :

  1. What is the problem here?

  2. If I want to show the image inside a td in the second tr and conditionaly show that second tr when confirm messages are present – what is the best way?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:04:50+00:00Added an answer on May 15, 2026 at 6:04 am

    The h:messages displays all messages, also the ones which are already displayed in a h:message in the page. You can however set it to only display messages with a null client ID using globalOnly="true".

    <h:messages globalOnly="true" />
    

    You can also give the message a different style depending on the FacesMessage.Severity:

    <h:messages infoClass="info" errorClass="error" />
    

    with for example this CSS which hides the INFO messages and makes ERROR messages red:

    .info {
         display: none;
    }
    .error {
         color: red;
    }
    

    You can use redisplay="false" to tell it to not display the already displayed messages via e.e. <h:message>.

    <h:messages redisplay="false" />
    

    You only need to make sure it’s placed in the component tree after all those other message components. You can if necessary make use of CSS to reposition it somewhere in top.

    Just to be sure,

    facesContext.addMessage("clientId",  facesMessage);
    

    this will attach the given message to a <h:message for="clientId"> not to a <h:messages id="clientId"> as you seem to expect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Mach port messages in Objective-C but I cannot find
When throwing custom exceptions or issuing messages to the end user, one could use
I am trying to use Objective-C blocks in an iPhone 3.1.3 app but am
I am need to parse a pdf file. I would like to use objective-c
Currently, my Objective C classes use C++ objects by doing a new when the
Is there an equivalent of the .NET ManualResetEvent class available for use in Objective-C
I use GNUStep to compile Objective-C on Windows 7 using GCC and MinGW. I'd
I use Doxygen to generate docs for my objective c code. Up to now
You can use a standard dot notation or a method call in Objective-C to
Is it possible to use the __unused attribute macro on Objective-C object method parameters?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.