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

  • Home
  • SEARCH
  • 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 6913155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:10:56+00:00 2026-05-27T09:10:56+00:00

I have an h:inputText element and an h:message for it: <h:form id=cancelForm> <h:inputText id=days

  • 0

I have an h:inputText element and an h:message for it:

<h:form id="cancelForm">
    <h:inputText id="days" />
    <h:message for="days" />
</h:form>

So when I open the page, JSF renders a “span” element for the error message. This is ok.
When I press submit the application goes to java and validates the fields:

// Some code
if (error) {
    FacesContext.getCurrentInstance().addMessage("days", new FacesMessage("Error message"));
    return error();
}

But after this JSF does not render the “span” for h:message.

Why?

  • 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-27T09:10:57+00:00Added an answer on May 27, 2026 at 9:10 am

    days is just the simple ID for the inputText component. For the addMessage call you need the full ID (the client ID).

    You can obtain the client ID by looking at the rendered HTML source code, or if all parent naming containers on your Facelet have IDs, guess it. It’s typically all the parent IDs concatenated with : as a separator.

    To always get the 100% correct ID, bind the inputComponent to your backing bean and in the code fragment you show above query it for its ID.

    Finally, one word of advice: typically the kind of error checking and adding faces messages is done via a Validator and/or Converter. Doing this in a backing bean should not be your first approach.

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

Sidebar

Related Questions

I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I have a form in which validation error message needs to be displayed below
I have a JSF page that is basically a create form. The form consists
I have a JSF page which has a variable number inputText elements containing numeric
I have the following form declaration: <div class=edit-dialog span-10 style=display:none;> <div class=edit-message span-10 style=margin-bottom:30px;>
In a JSP page, I created a <h:form enctype=multipart/form-data> with some elements: <t:inputText> ,
I have the following authentication form in JSF running on Glassfish 3: <h:messages globalOnly=true
I have a simple Zend-based form with reCaptcha element: $form = new Zend_Form(); $form->setName('forgotpassword')
I'm having an issue with JQuery and JSF/Richfaces. I have an inputText component inside
I have such code: <h:inputText id=input value=#{bean.input}> <f:convertNumber /> <rich:ajaxValidator event=onblur /> </h:inputText> I

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.