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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:04:21+00:00 2026-05-27T13:04:21+00:00

Im still not getting the wicket models. What am I doing wrong here? filterString

  • 0

Im still not getting the wicket models. What am I doing wrong here? filterString is still “” when the links onClick method prints it.

class X extends Panel {
    String filterString;
    TextField filterTextField;
    AjaxLink filterLink;

   X(){
       filterString = new String("");
       filterTextField = new TextField<String>("filterTextField", new PropertyModel<String>(this, "filterString"));
       filterLink = new AjaxLink<Void>("filterLink"){
           private static final long serialVersionUID = 1L;
           @Override
           public void onClick(AjaxRequestTarget target) {              
               params.setFilterString(filterTextField.getModelObject());
               System.out.println("BLABLABLA " + filterTextField.getModelObject());
           }
       };
       //add stuff etc
    }
}

EDIT:

OK, like Juha said using a Form works. Sometimes I feel like creating forms feels like overkill but since this is probably the most Wicket-y thing to do anyway, it is what I will use here. The class would look something like this:

public class X extends Panel {
    private static final long serialVersionUID = 1L;
    public X(String id) {
        super(id);
        add(new FilterForm("logEntryForm"));
    }

    public class FilterForm extends Form{
        private static final long serialVersionUID = 1L;
        private transient String text; //no need to serialize this
        public FilterForm(String id) {
            super(id);
            final TextField<String> contents = new TextField<String>("contents", new PropertyModel<String>(FilterForm.this, "text")); //textArea for user to enter the filter String
            add(contents);
            add(new AjaxButton("filterButton") {
                private static final long serialVersionUID = 1L;
                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    //do stuff, in my case it was to send the text to the database for filtering out results
                }
            }); 
        }
    }
}
  • 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-27T13:04:21+00:00Added an answer on May 27, 2026 at 1:04 pm

    Replace AjaxLink with Form and AjaxButton or something that has onSubmit() method. AjaxLink doesn’t do submit so browser doesn’t send the input value to server.

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

Sidebar

Related Questions

I have been reading up on Cloud computing on here and still not getting
I've made a few changes here but I'm still not getting what I expect
I have tried many things, but I'm still not getting this to work. Here's
I'm using .NET 3.5. Why am I still be getting: does not contain a
DO NOT DO THIS. This question is still getting upvotes, so I wanted to
I've read a dozen pages but im still not getting it. Where is the
I found some answers to similiar questions but I'm still not getting it. but
There is no synthesis error in the following code, but still not getting the
I've read a lot of post on here, and other sites, but still not
I am reading definitions over and over again and I still not getting what

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.