后台
/**
* 报表 制度下拉框值准备
* */
@RequestMapping(params = "findInstitution")
@ResponseBody
public JSONArray findAB01(HttpServletRequest request){
try{
String listSql = "SELECT ID,INSTITUTION FROM NS_INSTITUTION WHERE DELFLAG=0 ORDER BY CREATE_DATE DESC";
List<Map<String,Object>> list = systemService.findForJdbc(listSql);
if(list.size()>0){
JSONArray jsonArray = JSONArray.fromObject(list);
return jsonArray;
}else{
return null;
}
}catch(Exception e){
e.printStackTrace();
throw new BusinessException(e.getMessage());
}
}
@ResponseBody 很重要 不能忘记
返回格式
[
{
"id": "0",
"name": "中国"
},
{
"id": "1",
"name": "北京"
},
{
"id": "2",
"name": "上海"
},
{
"id": "3",
"name": "浙江"
},
{
"id": "4",
"name": "江西"
}
]
前端
<input id="institution" name="institution" class="easyui-combobox" data-options="width:500, valueField: 'ID', textField: 'INSTITUTION', url: 'executeExaminationController.do?findInstitution'"/>