代码如下:
    jsp:
function get(value)
 {
alert(value);
$.getJSON("accountrecharge!getCity.do",{"agentCode":value},function(data){
var second= $("#city")[0];
for(i=0;i<data.length;i++)
{
second.options[i]=new Option(data[i].agentName,data[i].agentCode);

}

});
}
action:
      String agentCode=request.getParameter("agentCode");
     List<BAgentVo> blist = this.accountRechargeService.searchCityByid(agentCode);
     response.setCharacterEncoding("UTF-8"); 
     JSONArray ja=new JSONArray();
try {
PrintWriter out= response.getWriter();
for (Iterator iterator = blist.iterator(); iterator.hasNext();) {
BAgentVo ck = (BAgentVo) iterator.next();
JSONObject jo=new JSONObject();
jo.put("agentCode", ck.getAgentCode());
jo.put("agentName", ck.getAgentName());
ja.add(jo);
}
out.print(ja);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
return null;
jsonaction