You are on page 1of 1

action public void fetchSites() throws NamingException, JSONException, IOException{ LOGGER.info("LoadAdjustmentForCentralAction fetchSites() Called"); LOGGER.

info("Get Load Adjustment Planning & Execution detail : " + getLo adAdjustmentForCentralForm().toString()); Map<String, String> siteMap = super.getSitesFromConcept(getLoadAdjustme ntForCentralForm().getConceptCode()); JSONObject jsonObject = new JSONObject(); for (Entry<String, String> counter : siteMap.entrySet()) { jsonObject.put(counter.getKey(),counter.getValue()); } PrintWriter out = response.getWriter(); out.print(jsonObject); out.flush(); } js file $(document).ready(function(){ $('#conceptList').change(function(){ if($('#conceptList').val()!='-1'){ $.getJSON("fetchSitesFromConceptForCentral?loadAdjust mentForCentralForm.conceptCode="+$('#conceptList').val(),function(data){ if(data!=null){ $.each(data, function(key, value ) { $('#siteList').append('< option value="'+key+'">'+value+'</option>'); }); } }); } else if($('#conceptList').val()=='-1'){ $('#siteList').val('-Select-'); $('#conceptList').focus(); } }); }); jsp <td class="fieldtext" width="20%"> <s:select name="loadAdjustmentForCentralForm.site" headerKey="-1" headerValue=" Select" list="loadAdjustmentForCentralForm.sitesMst" cssClass="dropdownbig" id=" siteList"></s:select>

You might also like