JAVAEE工程笔记3---下拉列表

HTML中html

<input class="mini-combobox"  id="profitCenter_Search" url="/costCen.do?

method=costCenByParentId&parentId=0" textField="name" valueField="id" />

controllerjava

/**
	 * @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;
	}

mamagerthis

/**
	 * @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();
	}
相关文章
相关标签/搜索