baidu,或者google里面输入关键字后,会弹出一个下拉菜单,里面显示类似的搜索统计,这个是怎么做的啊?比方说,你输入“中国”关键字然后会弹出下拉列表框如下:中国移动    980000条搜索结果
中国银行    98766771110000条搜索结果
................................
问下,这种功能是如何做的呢?检索什么关键字才可以找到类似的功能实例呢?

解决方案 »

  1.   

    ajax dwr 都可以实现.
     这里有个ajax的demo
    http://user.qzone.qq.com/287868587/blog/51
      

  2.   

    用ajaxTag把 很方便!只需要俩实现就OK了!
    页面:
    用户信息:<input type="text" name="userId" size="10" id="user"/>
    <!-- 用户信息自动提示 -->
    <ajax:autocomplete source="user" target="user"
    baseUrl="${ctx}/Login.do?method=loadUser" className="autocomplete" minimumCharacters="1" parameters="prefix={user}">
    </ajax:autocomplete>
    后台:/** 输入用户信息的时候自动提示信息
     * @throws IOException */
    public ActionForward loadUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException{
    response.setCharacterEncoding("UTF-8");
    response.setContentType("text/xml");
    PrintWriter out = response.getWriter();
    String name = this.getStringParameter(request,"prefix");
    //获取全部的用户信息
    List<SysUser> userList = sysUserService.findUserByName(name);
    out.println("<ajax-response>");
    out.println("<response>");
    //循环创建
    for(SysUser user : userList) {
    out.println("<item>");
    out.println("<name>"+user.getTrueName()+" "+user.getDept().getName()+"</name>");
    out.println("<value>"+user.getId()+"</value>");
    out.println("</item>");
    }
    out.println("</response>");
    out.println("</ajax-response>");
    return null;
    }
    就这么简单 需要的话可以给你demo
      

  3.   

    Ajax,再适当加些CSS代码在《征服Ajax Web 2.0开发技术详解》这本书中就有这个例子!
      

  4.   

    http://www.aa25.cn/724.shtml
    AJAX可以做出来,显示出来类似于上面的叶面
      

  5.   


    你好,给demo吧,谢谢了!
    看你的实例是struts的吧,我也是struts的,正好用上啊,还有你用的是什么js框架?
      

  6.   

    http://www.hansir.cn/blog/2008/20080616-27.html
    http://www.diybl.com/course/4_webprogram/search/2008422/110885.html可以拿去参考