JAVAEE工程筆記7---下拉列表

<td >
       類別
</td>
<td colspan="1">
<input class="mini-combobox" name="typeId" required="true" url="/dictEntry.do?

method=getDictEntryByDictTypeId&dictTypeId=YW_CUSTOMER_TYPE" textField="dictName" valueField="dictId"/>
</td>
<td >

controllerhtml

public ModelAndView getDictEntryByDictTypeId(HttpServletRequest request,
			HttpServletResponse response) {

		String dictTypeId = request.getParameter("dictTypeId");

		List<DictEntry> list = dictEntryManager
				.getDictEntryByDictTypeId(dictTypeId);

		this.renderText(response, JSONArray.fromObject(list).toString());
		return null;
	}

managerjava

public List<DictEntry> getDictEntryByDictTypeId(String dictTypeId) {

		Criteria criteria = this.getCriteria();
		criteria.add(Restrictions.eq("dictTypeId", dictTypeId));
		criteria.addOrder(Order.asc("dictId"));
		return criteria.list();
	}
相關文章
相關標籤/搜索