easyui datagrid combobox通过url获取json数据的下拉框

------前台部分------------

数据关联 

------后台json部分-------

//json
public void getrelationtypeByMarkDCList()  
{
try {
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
try {
creditRelationTypeList = wfDataDicImpl.getByMarkDCList(DictionaryID.RELATION_TYPE);
 jsonArray = JSONArray.fromObject( creditRelationTypeList );
} catch (Exception e) {
e.printStackTrace();
}
response.getWriter().write(jsonArray.toString());// 返回json类型对象
response.getWriter().close();
} catch (IOException e) {
e.printStackTrace();
}
       
}
/**
* 根据字段value查询name
*/
public void getDICName()
{
String dicname="";
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
try {
if (!StringUtils.isEmptyOrNull(dicValue)) {
 
List wfdatadiclist = wfDataDicImpl
.getByMarkDCList(DictionaryID.RELATION_TYPE);
for (WfDataDic wfDataDic : wfdatadiclist) {
if (dicValue.equals(wfDataDic.getValue())) {
 dicname=wfDataDic.getName();
}
}
response.getWriter().write(dicname);
response.getWriter().close();
}
} catch (IOException e) {
e.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
}
 
}

--------获取节点部分-------

if(!StringUtils.isEmptyOrNull(lc.getRelationtype()))
 {
 sb.append("\"relationtype\":\""+lc.getRelationtype()).append("\",");
/*for (WfDataDic wfDataDic : wdclist) {
if(lc.getRelationtype().equals(wfDataDic.getValue()))
{
sb.append("\"name\":\""+wfDataDic.getName()).append("\",");
}
 }*/
 }


你可能感兴趣的:(私密博客,demo)