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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:59:02+00:00 2026-06-10T03:59:02+00:00

I have a : Client Class ListView TextField I need to populate my ListView

  • 0

I have a :

  • Client Class
  • ListView
  • TextField

I need to populate my ListView in order to form a table:

WORKING CODE:

clientModel = new LoadableDetachableModel() {

            @Override
            protected Object load() {

                return Client.getClientListByCompanyName(searchClientInput.getValue());
            }
        };

        searchClientInput.setModel(new Model<String>());

        searchClientInput.add(new AjaxFormComponentUpdatingBehavior("onkeyup") {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {

                target.add(clientListViewContainer);
            }
        });

        clientListView = new ListView<Client>(CLIENT_ROW_LIST_ID, clientModel) {

            @Override
            protected void populateItem(ListItem<Client> item) {

                Client client = item.getModelObject();

                item.add(new Label(CLIENT_ROW_COMPANY_CNPJ_ID, client.getCompanyName()));
                item.add(new Label(CLIENT_ROW_COMPANY_NAME_ID, client.getCompanyCnpj()));
            }
        };

        clientListViewContainer.setOutputMarkupId(true);

        clientListViewContainer.add(clientListView);

        add(clientListViewContainer);

Now, in my HTML, I have a TextField. Whenever an user types something in this TextField, a select will be made in the database with whatever he typed. So for each word, a select is made, and the table needs to be updated. I am guessing I will need to use AJAX and possibly a Model. I’m kind of lost about how I can do this, if someone can provide me examples I would be very grateful.

EDIT: New code that is throwing exception: Last cause: Attempt to set model object on null model of component: searchClientForm:searchClientInput

EDIT 2: Ok so the exception was that my TextField didn’t had a model to bind data to. So what I did was: searchClientInput.setModel(new Model<String>());

I also had a problem with the event. Using onkeydown was working, but not as intended. I had Company Name 1-4. If I typed Company Name 1, I would need to press one key again so the table would get updated. With onkeyup this don’t happens. Thanks for the help.

  • 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-10T03:59:03+00:00Added an answer on June 10, 2026 at 3:59 am

    You could give the ListView a LoadableDetachableModel which provides the selected clients matching your TextField’s value.

    Use an AjaxFormComponentUpdatingBehavior on your TextField which add a parent of the ListView to the request target (don’t forget #setOutputMarkupId().

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

Sidebar

Related Questions

In java, I have my client class that have the code attr, and the
I have a Client class like that: public class Client { public Person Pers
If I have a Client domain class, and that Client hasMany Courses. How do
I have a class Client like that: public class Client { public Person Pers
Hope I'm asking this correctly: I have a project Projects.Client I have my class
so... I have a simple chat client like so: class ChatClient(sleekxmpp.ClientXMPP): def __init__(self, jid,
I have a server class which connects a client on a specific server socket
In a client application I have a DBIx::Class model 'Todo' that can be linked
I have a web service client that has an Authenticator class. The Authenticator requires
Per a client's request I have written a communication class that inherits from webclient.

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.