How to pass option key and value as an object from jsp to Struts 2 action class?

770 views Asked by At

I have a scenario where I want to send SelectOption object to action class on change of struts jQuery dropdown, but it seems like it`s not possible.

Is there any workaround or any way out to get this done?

JSP code:

<sj:select href = "%{fetchCountry}" 
             id = "country" 
 onChangeTopics = "reloadsecondlist" 
           name = "country" 
          value = "%{country}"
           list = "countryList" 
        listKey = "key" 
      listValue = "value" 
    emptyOption = "false"
      headerKey = "-1" 
    headerValue = "Please Select a Country" />

Note: DropDown consist of list of SelectOption object.

Update:

<s:url id="fetchState" action="json" method="fetchState" namespace="/"/>

<sj:select href = "%{fetchState}" 
             id = "stateID" 
        formIds = "formSelectReload"
   reloadTopics = "reloadsecondlist" 
           name = "state" 
          value = "%{state}" 
           list = "stateMap" 
        listKey = "key" 
      listValue = "value" 
    emptyOption = "false" 
      headerKey = "-1" 
    headerValue = "Please Select a State" />
0

There are 0 answers