jquery-ui-custom autocomplete
//jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>autocomplete</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<%=basePath%>js/autocomplete/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<script src="<%=basePath%>js/jquery-1.7.2.min.js"></script>
<script src="<%=basePath%>js/autocomplete/jquery-ui-1.10.3.custom.js"></script>
<script>
$(function(){
$( "#autocomplete" ).autocomplete({
minLength: 1,//最少输入1个字符才执行
source: 'autocomplete.action'
});
})
</script>
</head>
<style>
body {
font: 62.5% "Trebuchet MS", sans-serif;
margin: 50px;
}
</style>
<body>
<h2 style="margin-top: 2em;">
Autocomplete
</h2>
<div>
<input id="autocomplete" title="type "a"">
</div>
</body>
</html>
//struts.xml
<action name="autocomplete" class="com.test.action.testAction" method="autocomplete"></action>
//java
public String autocomplete() throws Exception{
String[] temp = "align,both,card,dream,error,fail,gson,hello,invaid,job,kill".split(",");
String name = "[";
for(int i=0;i<temp.length;i++){
if(temp[i].indexOf(term)!=-1){
name += "\""+temp[i]+"\",";
}
}
if(name.length() > 1)
name = name.substring(0,name.length()-1);
name+="]";
System.out.println(name);
HttpServletResponse res = ServletActionContext.getResponse();
PrintWriter pw = res.getWriter();
pw.write(name);
pw.flush();
pw.close();
return null;
}
jquery-ui-custom autocomplete的更多相关文章
- 弹窗中使用jquery ui的autocomplete自动完成插件无效果 实际是被遮挡了
在普通页面上使用jquery ui的autocomplete自动完成插件时正常显示提供选择的下拉框,但是放到弹窗中的时候就无法显示这个选择的下拉框,其它效果正常: 估计是被弹出窗遮挡了,网络搜索了jq ...
- ASP.NET jQuery 随笔 使用jQuery UI的Autocomplete方法实现文本框的自动搜索填充功能
首先当然是去下载JQuery UI ,这里这里是下载地址http://jqueryui.com/ 第一步是点击这里 第二步选择你想要下载的主题进行下载 我这里是选择的cupertino主题包 点击圆圈 ...
- Jquery UI Custom的兼容问题
在测试过程中遇到Jquery UI Dialog异常的情况,表现为在拖拽Dialog标头时出现Dialog跳跃的问题,对比jquery ui与jquery在协调工作情况下的运行情况. 1.环境: Wi ...
- JQuery UI之Autocomplete(4)多值输入、远程缓存与组合框
1.多值输入 首先加入相关的css和js文件,以及对应的HTML代码如下: <link href="../css/jquery-ui.css" rel="style ...
- JQuery UI之Autocomplete(3)属性与事件
1.Autocomplete的属性 首先引入css和js文件,以及对应的HTML代码如下: <link href="../css/jquery-ui.css" rel=&qu ...
- JQuery UI之Autocomplete(1)入门程序
1.Autocomplete的主要属性:source:即为指定智能提示下拉框中的数据来源,支持三种类型. Array,主要用于本地化数据提供,支持两种格式:字符串数组 [ "Choice1 ...
- JQuery UI之Autocomplete(2)后端获取数据
1.Autocomplete获取后台数据 首先引入css和js文件,以及对应的HTML代码如下: <link href="../css/jquery-ui.css" rel= ...
- Node.js配合jQuery UI autocomplete的应用
Node.js擅长的领域为: 不需要很多运算 吞吐量要求高 进消息轻并且要求快 出消息轻并且要求快 网上的例子都是socket.io的,我一直在想到底能用在什么地方?根据node.js的优点(擅长领域 ...
- jQuery ui autocomplete下拉列表样式失效解决,三种获取数据源方式,
jQuery有很多很多的已经实现,很漂亮的插件,autocomplete就是其中之一.jQuery ui autocomplete主要支持字符串Array.JSON两种数据格式,jQuery ui b ...
- JQuery UI Autocomplete与jquery.autocomplete.js
程序中要把一个select改成可以下拉搜索的,就想到了使用下autocomplete.js大概是这么个东西. 问了下同学,推荐我使用Jquery Ui autocomplete,下载下来开始调试使用, ...
随机推荐
- Android Studio中导入v4,v7和recyclerview-v7包的方法
概述 Android Studio中新建工程中会默认导入v7的包,即在gradle中默认配置了com.android.support:appcompat-v7:x.x.x的依赖.但是不会默认为我们配置 ...
- Makefile2
规范 target可以是Object file, 可执行文件或者标签(标签一般没有依赖) 越靠近最终结果的target卸载越前面 定义target前, 定义CC, SRC, CFLAGS, OBJS, ...
- checkbox判断选中的三种方法
方法一: if ($("#checkbox-id")get(0).checked) { // do something } 方法二: if($('#checkbox-id' ...
- js获取日期:前天、昨天、今天、明天、后天
前天,昨天,今天,明天,后天 <html> <head> <meta http-equiv="Content-Type" content=" ...
- hdu 3586 最小代价切断根与叶子联系
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3586 http://blog.csdn.net/woshi250hua/article/details ...
- java实现一个简单的数学表达式分析器(加减乘除和括号)
1.使用此分析器需要输入两个量: String str1=运算符号有前后有空格的数学表达式(如 1 + 2 * ( 3+1) - 5 #),并在最后添加‘#’字符作为结束标志: String st ...
- Cordova各个插件使用介绍系列(八)—$cordovaCamera筛选手机图库图片并显示
原文档请看http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/ionic%E5%9B%BE%E7%89%87%E4%B8%8A%E4%B ...
- SpringBoot 很重要的一个类WebMvcConfigurerAdapter 的使用
自定义资源映射addResourceHandlers 比如,我们想自定义静态资源映射目录的话,只需重写addResourceHandlers方法即可. @Configuration public cl ...
- Eclipse: 导入项目乱码问题解决
1.编码不对 a.对某文件或某工程更改编码: 鼠标移到工程名或文件名,右键->Properties->Resource->Text file enCoding ->更改编码(G ...
- vos限制客户呼出时间
问题: 公司希望自己的卡线晚上 21:00-24:00 早上00:00-7:30不能打出电话,以防遭投拆, 那么如何设置? 方法: 找到客户使用的落地网关, 落地网关——补充设置——