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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:02:00+00:00 2026-06-11T09:02:00+00:00

I am having a method to get the countryname list from the database and

  • 0

I am having a method to get the countryname list from the database and a method to fetch statenames for any provided countryname. But not sure how to link both for country and state.

    <sx:autocompleter list="countrynames" name="employee.countryname" value="%{employee.countryname}" label="%{getText('label.countryname')}"/>

    <sx:autocompleter list="statenames" name="employee.statename" value="%{employee.statename}" label="%{getText('label.statename')}"/>

I am having arraylists with name ‘countrynames’ and similarly ‘statenames’ but not sure how to get statenames dynamically generated based on the selection of a country in the above country list and how can i connect that fetched countryname to the method to call explicitly the list of states in the country.

  • 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-11T09:02:01+00:00Added an answer on June 11, 2026 at 9:02 am

    A few suggestion i would like to give you

    1. Struts2 Dojo plugin is not more in development and is deprecated so i will suggest you not to go for it else you can use plain DOJO with struts2.

    There is a Jquery plugin which is in active use and will provide you most of the functionality which you are looking for, have a look at A_simple_Doubleselect_with_Topics.

    I am not a big admirer of this plugin as it limit us a lot in implementation though it provides us a lot of good widgets and features

    my suggestion is to use following approach

    1. Add Struts2-JSON plugin so as to send back JSOn data from action.
    2. User simple Jquery to send data to server and get back JSON and with help of Jquery JSON parsing technique fill the second drop down.

    Add a on-change event to your first drop down and create a function where you will fill the second drop down

    function fill statenames(countryID)
    var formInput='country='+countryID;     
    $.getJSON('search/getStateNames',formInput,function(data) {
        $("#employee.statename  option:first").val("-1").text("Please select state");
        $('.result').html('' + data.states + '');
        $.each(data.states ,function(index, value){
        var stateid= document.getElementById("state");
        var option=new Option(value,value);
       try{
         stateid.add(option);
        }
        catch(e){
          stateid.appendChild(option);
       }
    });
                });
    

    Action Class

    public class StateListAction extends ActionSupport{
    
       private String country;
       // getter and setter
      private List<String> states;
       //getter and setter
    
      public String getStateList(){
        states=fillStatebasedonCountry(country);
        return SUCCESS;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some troubles with a method having a typed List parameter, inherited from
I am having a strange issue. My NSTimer CallMe method does not get fired
I'm having a method that exports content from the database to excel files. The
Having a method like this: @GET @Path(/name/{name}) @Produces(MediaType.TEXT_PLAIN) public String getProperty(@PathParam(name) String name) {
having the method public void foo(){ //.. } Is there a way to get
I'm having a problem with SimpleXML. When I'm using the children() method to get
is there any javascript method to get text, and split it after a certain
I'm having a problem while trying to call a custom Model method from my
Having this method: public Boolean isCorrect() { return correct; } I can't write: @XmlType(propOrder
I've got a prototype having a method I can add callbacks with: /* *

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.