不确定是否有可能,如果我有以下 autoComplete 代码,我如何在 jstl 代码中使用它来实现相同的功能?或者有没有其他方法可以实现这一目标?
<input type="text" id="department" name="department"/>
<script>
$("#department").autocomplete("getdept.jsp",{minChars: 4});
</script>
并且在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);
}