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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:15:42+00:00 2026-06-04T04:15:42+00:00

I’m trying to collect values of an UIInput component inside an UIData component during

  • 0

I’m trying to collect values of an UIInput component inside an UIData component during bean’s action method in order to validate duplicate values. I tried to bind the UIInput component to a bean property and getting its value, but it prints null. If I place it outside the datatable, then it prints the expected value. Is there something wrong with the datatable?

<rich:dataTable binding="#{bean.table}" value="#{bean.data}" var="item">
    <h:column>
        <f:facet name="header">
            <h:outputText value="Field1" />
        </f:facet>
        <h:inputText binding="#{bean.input}" value="#{item.field1}" />
    </h:column>
</rich:dataTable>

Here’s the backing bean code:

private UIData table;
private UIInput input;

public void save() {
    System.out.println(input.getId() + " - " + input.getValue());
}
  • 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-06-04T04:15:43+00:00Added an answer on June 4, 2026 at 4:15 am

    There’s nothing wrong with the datatable. There’s only one UIInput component in the JSF component tree whose state get changed everytime whenever the parent UIData component iterates over every item of the model. The state is thus only available during the UIData iteration and not before or after. You’re trying to access the value of a single component in the bean’s action method while the parent UIData component isn’t iterating over it, so the values will always return null.

    You need to visit the component tree by UIComponent#visitTree() on the UIData and collect the information of interest in the VisitCallback implementation.

    table.visitTree(VisitContext.createVisitContext(FacesContext.getCurrentInstance()), new VisitCallback() {
        @Override
        public VisitResult visit(VisitContext context, UIComponent target) {
            if (target instanceof UIInput) {
                UIInput input = (UIInput) target;
                System.out.println("id: " + input.getId());
                System.out.println("value: " + input.getValue());
            }
    
            return VisitResult.ACCEPT;
        }
    });
    

    By the way, you’d normally perform the validation with a normal Validator on the UIInput component or, in this particular case maybe better, a ValueChangeListener. This allows for easier invalidation and message handling.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put

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.