我在 JSF 中有一个自动完成输入字段。
我的 JSP 代码
<h:form id="setupValue">
<input type="text" id="department" name="department"/>
<script>
$("#department").autocomplete("getdept.jsp",{minChars: 4});
</script>
</h:form>
在 getdept.jsp 中
DepartmentMB dept = new DepartmentMB ();
String query = request.getParameter("q");
List<String> dep = dept.getData(query);
Iterator<String> iterator = dep .iterator();
while(iterator.hasNext()) {
String department = (String)iterator.next();
String deptName=(String)it.next();
out.println(deptName);
}
如何发送department
到隐藏字段并显示deptName
到 inputText 字段?
谢谢