仿Google自动补全 jQuery 不含索引处理 2

Servlet。。。。。。。。。。。。。。。。。

public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

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

		System.out.println(paramInfo);
		
	//…………数据处理

		request.setAttribute("autoCompleteList", list);

		request.getRequestDispatcher("./js/autoComplete.jsp").forward(request,
				response);

	}

 

体现mvc的思想,jQuery获得的返回页面是text/xml格式

<%@ page language="java" pageEncoding="utf-8" contentType="text/xml; charset=utf-8"%>
<%@taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
<%@taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>

<keys>
	<logic:notEmpty name="autoCompleteList" scope="request">
		<logic:iterate id="liststr" name="autoCompleteList" scope="request">
			<key><bean:write name="liststr"/></key>
		</logic:iterate>
	</logic:notEmpty>
	
</keys>

 

你可能感兴趣的:(apache,jquery,bean,struts,Google)