jQuery自动填充

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'autSelect.jsp' starting page</title>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.autocomplete.js"></script>

  </head>
 
  <body>
    This is my JSP page. <br>
    <input type="text" name="q" id="query11" />
    <div class="search_item_content"> 
<b>商品搜索</b> 
<input type="text" name="q" id="query" value=""/> 
<input type="submit" value="搜索" class="btn" /> 
</div>

<script type="text/javascript">
var options, a;
jQuery(function(){
  //options = { serviceUrl:'http://localhost:8088/JQuery/servlet/DataJson' };

  $('#query').autocomplete({
    serviceUrl:'jsondata.json',
    minChars:1,
    delimiter: /(,|;)\s*/, // regex or character
    maxHeight:400,
    width:300,
    zIndex: 9999,
    deferRequestBy: 0, //miliseconds
    //params: { country:'Yes' }, //aditional parameters
    noCache: false, //default is false, set to true to disable caching
    // callback function:
    onSelect: function(value, data){ alert('You selected: ' + value + ', ' + data); },
   
    // local autosugest options:
    lookup: ['Januarssssss','Java','Jack','Jason','Jawa', 'February', 'March', 'April', 'May'] //local lookup values
 
  });
});
</script>
  </body>
</html>

你可能感兴趣的:(java,jquery,jsp,json,servlet)