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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:42:39+00:00 2026-06-06T13:42:39+00:00

I am developing a search functionality with wicket. The DropDownChoice class is used to

  • 0

I am developing a search functionality with wicket. The DropDownChoice class is used to select which field of the searched item is to be searched. How to accomplish this so that the drop down names would be taken directly from the searched class.

Let’s say I have a class FooBar containing variables foo and bar. If I want to select which one is the select criteria field, how I can get the naming from a resource file giving values in my resource file like

   FooBar.foo="Search for foo"
   FooBar.bar="Search for bar"

The resource file should be like that, but how to wire this in java class side?

  • 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-06T13:42:41+00:00Added an answer on June 6, 2026 at 1:42 pm

    First of all you can get fields and its values like this

    import java.lang.reflect.Field;
    
    public class FooBar extends AbstractFooBar{
    public String foo = "Search for foo";
    public String bar = "Search for bar";
    
    public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {
        Field[] fields = FooBar.class.getFields();
        // Field[] fields = AbstractFooBar.class.getFields();
        for (Field field : fields) {
            System.out.println(field.get(new Object()).toString());
        }
    }
    

    }
    But as you can guess you cannot use any abstraction. Also all your fields must be public.

    You can initialize your class by using resource file. You can pass fields by using IChoiceRenderer, to DropDownChoice after getting field with reflection.

    Your DropDownChoice type can be Field and you can initialize it by giving field list. Then in your IChoiceRenderer you can get model object.

    I hope it will help.

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

Sidebar

Related Questions

I am developing a website in which i want to give a search functionality
I am developing an android app which requires search functionality. My app contains action
I'm developing a custom search control and setting its configuration based on this sample
i'm developing a meta search engine website, Soogle and i've used JS to populate
I'm developing a Ruby on Rails application need some advanced search engine functionality: specifically,
I'm developing a search that have a dynamic number of checkboxes and a price
I am developing a search portal, so I need to find the searched text
I'm developing a search form with a button that adds up to 4 State/City
im developing a map application in android that search for places in the database
I have a query. I am developing a site that has a search engine.

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.