import cn.sunfengwei.suggest.model.*; public class SearchServlet extends HttpServlet {
/** * The doGet method of the servlet.
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String search=request.getParameter("search"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); SearchDAO searchDAO=new SearchDAO(); out.print(searchDAO.getSearch(search)); searchDAO.close(); out.flush(); out.close(); } }
6. WEB项目配置文件 web.xml
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> user user of ajax SearchServlet cn.sunfengwei.suggest.controller.SearchServlet
//create XMLHttpRequest object function getXmlHttpRequestObject() { var xmlhttp=false; try{ xmlhttp= new ActiveXObject('Msxml2.XMLHTTP'); }catch(e){ try{ xmlhttp= new ActiveXObject('Microsoft.XMLHTTP'); }catch(e){ try{ xmlhttp= new XMLHttpRequest(); }catch(e){} } } return xmlhttp; }
var searchXmlRequest=getXmlHttpRequestObject(); function searchSuggest() {
var str = escape(document.getElementById('txtSearch').value); searchXmlRequest.open("get","search?search="+str,true); searchXmlRequest.onreadystatechange=handleSearchSuggest; searchXmlRequest.send(null);
} // end function searchSuggest
function handleSearchSuggest() { if(searchXmlRequest.readyState==4) { var divSearch=document.getElementById("search_suggest"); divSearch.innerHTML=""; var str=searchXmlRequest.responseText.split("/n"); for(i=0;i{ var suggest="
转自于:http://www.iteye.com/problems/23775
问:
我在开发过程中,使用hql进行查询(mysql5)使用到了mysql自带的函数find_in_set()这个函数作为匹配字符串的来讲效率非常好,但是我直接把它写在hql语句里面(from ForumMemberInfo fm,ForumArea fa where find_in_set(fm.userId,f
1、下载软件 rzsz-3.34.tar.gz。登录linux,用命令
wget http://freeware.sgi.com/source/rzsz/rzsz-3.48.tar.gz下载。
2、解压 tar zxvf rzsz-3.34.tar.gz
3、安装 cd rzsz-3.34 ; make posix 。注意:这个软件安装与常规的GNU软件不
Forwarded port
Private network
Public network
Vagrant 中一共有三种网络配置,下面我们将会详解三种网络配置各自优缺点。
端口映射(Forwarded port),顾名思义是指把宿主计算机的端口映射到虚拟机的某一个端口上,访问宿主计算机端口时,请求实际是被转发到虚拟机上指定端口的。Vagrantfile中设定语法为:
c
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or ve