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 7610689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:28:42+00:00 2026-05-31T01:28:42+00:00

I am building a table using a <ui:repeat> tag, and its length is dynamic.

  • 0

I am building a table using a <ui:repeat> tag, and its length is dynamic. Each row has a <h:inputText> field. When the form is submitted, it sets the values from the form into a hashmap. That all works great, except for the validation. I need to tell the <h:message> which input it belongs to using the “for” attribute. I’ve tried to create a unique ID per row, based on the name of the item being used to create the row. But the <h:message> tag remains empty when I submit an invalid input, and I get the following output on the servers log (JBoss 7.1):

[javax.enterprise.resource.webcontainer.jsf.renderkit]
Unable to find component with ID nTAS in view.

Here is the XHTML:

<ui:repeat var="item" ...>
...
<h:inputText value="#{bean.chosenItems[item.name]}" id="n#{item.name}" >
    <f:validateLongRange minimum="0" maximum="10" />
</h:inputText>
<h:message for="n#{item.name}" />
...
</ui:repeat>

In order to at least get some kind of error message in the browser, I also added this near the top of my page, and it works:

<h:messages styleClass="error" />

It displays this message:

j_idt13:j_idt17:1:n: Validation Error: Value is not of the correct type.

And that kind of shows part of the problem, since the ID is that strange code at the start of the message, and it starts with “n”, but doesn’t contain the item’s name. If I look at the source in the browser, the ID is actually: id="j_idt13:j_idt17:1:nTAS"

If I look at other components, outside of the table, they also have cryptic IDs, apparently generated by JSF.

And what is really weird is that when I input “asdf” a second time, and re-submit the form, it then calls the action method on the bean, instead of again failing during validation phase!! How can that be?!

Thanks for any hints,
John

  • 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-31T01:28:44+00:00Added an answer on May 31, 2026 at 1:28 am

    You cannot create IDs dynamically with el expressions. And the “cryptic” IDs are indeed generated by jsf if you don’t assign an ID to a component.

    But you don’t need to care for the uniqueness of your ids in ui:repeat. JSF does it for you (the “1” in the generated id string is the counter for your repeated component). Just give your input field a “fixed” id and reference it in your h:message:

    <h:inputText value="#{bean.chosenItems[item.name]}" id="myID" >
        <f:validateLongRange minimum="0" maximum="10" />
    </h:inputText>
    <h:message for="myID" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When building an application and you are using a table that has a primary
I am building a table using the DataGridView where a user can select items
I'm building a table with some text that is HTML, so I am using
I am currently building a very dynamic table for a list application, which will
I'm building a form with php/mysql. I've got a table with a list of
Hey. I urgently need some help on building up a complete table using VBA.
I'm building multi tenant application with shared table structure using Microsoft SQL Server. I
I'm parsing out an HTML table and building an array based on the row
I'm using jQuery, building a table through a loop. I thought the best way
I'm just building a table to store hierarchical data using the Modified Pre-order Tree

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.