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();
	}
相關文章
相關標籤/搜索