HTML中
<input class="mini-combobox" id="profitCenter_Search" url="/costCen.do?
method=costCenByParentId&parentId=0" textField="name" valueField="id" />
controller
/**
* @title 根据父id获取参数列表
* @author wangyu
* @date 2017-04-17
* @param parentId
* 父节点id
*/
public ModelAndView costCenByParentId(HttpServletRequest request,
HttpServletResponse response) {
String parentId = request.getParameter("parentId");
List<CostCen> list = costCenManager.getAllCostCenByParentId(String.valueOf(parentId));
this.renderText(response, JSONArray.fromObject(list).toString());
return null;
}
mamager
/**
* @title 根据父id获取参数列表
* @author wangyu
* @date 2017-04-17
* @param parentId
* 父节点id
*/
public List<CostCen> getAllCostCenByParentId(String parentId) {
Criteria criteria = this.getCriteria();
criteria.add(Restrictions.eq("parentId", parentId));
criteria.addOrder(Order.asc("createTime"));
return criteria.list();
}