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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:53:25+00:00 2026-05-28T07:53:25+00:00

I am trying to validate multiple components in a ui:repeat . How can I

  • 0

I am trying to validate multiple components in a ui:repeat.

How can I get UIInput from a ui:repeat in the SiteBean?

JSF code is:

    <f:event listener="#{siteBean.listenerMyListener}" type="preValidate" />
    <ez:inputText id="txtMY" required="true" value="Hallo" />

    <ui:repeat
        id ="myRepeat"
        var="item"
        value="#{siteBean.myList}"
        varStatus="status">

        <ez:panel style="margin-bottom: 7px; #{status.even ? 'background-color: #E6EFC2;' : 'background-color: #e5f1fa;'}">

            <h:messages for="hiddenValidation" />
            <h:inputHidden id="hiddenValidation" value="" />

            <h:outputText value="Rechnung vom:" />
            <ez:inputText id="txtDatum" value="#{item.datum}"
                          style="width: 100px; text-align: right;">
                <f:convertDateTime pattern="dd.MM.yyyy" />
            </ez:inputText>

            <br /><br />

            <h:outputText value="Netto:" />
            <ez:inputText id="txtNetto" required="true" value="#{item.netto}" style="width: 100px; text-align: right;">
                <f:convertNumber pattern="###0.00" />
                <f:validateBean />
            </ez:inputText>

            <br /><br />

            <h:outputText value="Brutto:" />
            <ez:inputText id="txtBrutto" required="true" value="#{item.brutto}" style="width: 100px; text-align: right;">
                <f:convertNumber pattern="###0.00" />
            </ez:inputText>

        </ez:panel>

    </ui:repeat>

Bean code:

public void listenerMyListener(ComponentSystemEvent event) {

    FacesContext context = FacesContext.getCurrentInstance();

    UIComponent components = event.getComponent();


    UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();


    UIInput search_txtMY = (UIInput) viewRoot.findComponent("frmMY:txtMY");
    String value_txtMY = search_txtMY.getLocalValue().toString(); // Hallo


    UIInput search_txtDatum = (UIInput) viewRoot.findComponent("frmMY:myRepeat:0:txtDatum"); // NULL
    String value_txtDatum = search_txtDatum.getLocalValue().toString(); // java.lang.NullPointerException  

}
  • 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-28T07:53:25+00:00Added an answer on May 28, 2026 at 7:53 am

    An <ui:repeat> is not a view build time tag, but a view render time tag. There’s only one <h:inputText> component in the view tree, identified by frmMY:myRepeat:txtDatum. It’s however rendered multiple times, as many times as the <ui:repeat> iterates. If you were using <c:forEach>, which is a view build time tag, then there are indeed multiple <h:inputText> components in the view, each which are rendered only one time.

    You need to solve the problem differently. The <c:forEach> might not be the right solution as it may have nasty “side effects”, depending on how your entire view and model is designed. As the functional requirement is unclear and the need to collect the input values in a system event listener does not make any sense (I can’t think of any sensible real world applicances of this approach), I can’t suggest anything how to solve it differently and properly. I guess that you just need a Validator.

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

Sidebar

Related Questions

I am trying to get jquery validate to work on multiple fields. Reason being
When trying to validate my site, I get the following error: Line 188, column
I'm trying to validate the following XML but I'm unable to, can you please
I’m trying to validate input by using egrep and regex.Here is the line from
Using Rails I'm trying to get an error message like The song field can't
I'm trying to validate a few python arguments. Until we get the new static
i'm trying to allow user to upload multiple images but when i validate the
I have multiple check boxes from a many to many relationship, And i'm trying
I'm trying to make this simple code of creating 3 multiple-choice question out of
I'm trying to validate uniqueness of an entity submitted from a form by using

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.