- 浏览: 125383 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
wellba:
完美的解决了问题,谢谢分享
Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): -
u013641752:
添加上去了,但是结果好像一样的,也是删除不了呢。而且是只有删除 ...
Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): -
zl584521:
NAMES.DIRECTORY_PATH= (TNSNAMES ...
PLSQL连接ORACLE详解 -
hezonghuan:
谢了!
Eclipse 中Tomcat 启动报错:java.net.SocketException: select failed -
zhonglijunyi:
学习中,但是PL/SQL连接碰到很多问题啊
PLSQL连接ORACLE详解
附件里是修改过的 jquery.autocomplete.js(其实只是escape,unescape下输入框值)
页面代码:
后台代码:
后台把解密了两次,其解密的方法是:
页面代码:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk"> <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script> <script type="text/javascript" src="js/jquery.autocomplete.js"></script> <link rel="stylesheet" href="style/jquery.autocomplete.css" type="text/css" media="screen, projection"/> <script type="text/javascript"> $(function(){ $("#txtSubSysInfo").autocomplete("/case/task/getSubSysInfo.shtml", { minChars: 0, width: 400, mustMatch: true, autoFill: false, multiple: true, multipleSeparator: "; ", parse: function(data){ var parsed = []; var rows = data; for (var i=0; i < rows.length; i++) { var row = rows[i]; if (row) { parsed[parsed.length] = { data: row, value: row.ID, result: this.formatResult(row) }; } } return parsed; }, formatItem: function(row, i, max) { return "[" + row.ID + "]" + row.ENNAME + "(" + row.CNNAME + ")"; }, formatResult: function(row) { return row.CNNAME; } }).result(function(e, data, value){ $('#hidSubSysInfo').val(value); }); }); </script> </head> <body> <input style="width: 600px;" id="txtSubSysInfo" name="txtSubSysInfo"/></br> <input style="width: 600px;" id="hidSubSysInfo" name="hidSubSysInfo"/> </body> </html>
后台代码:
public ModelAndView getSubSysInfo(HttpServletRequest request ,HttpServletResponse response) throws Exception{ String queryString = request.getParameter("q"); Writer out = null; try { response.setContentType("text/json; charset=gbk"); out = response.getWriter(); queryString = queryString == null ? "": queryString; queryString = DateUtil.unescape(DateUtil.unescape(queryString)); int index = queryString.lastIndexOf(";")+1; queryString = queryString.substring(index == -1 ? 0 : index).trim(); List<Map> sysList = this.serviceInstance.getSubSysInfo(queryString.toUpperCase()); String sysJson = JSONArray.fromObject(sysList).toString(); out.write(sysJson); } catch (Exception e) { log.error("获取子系统异常", e); JSONObject jsonObject = new JSONObject(); jsonObject.element("errorMsg", e.getMessage()); out.write(JSONArray.fromObject(jsonObject).toString()); }finally{ out.flush(); out.close(); } return null; }
后台把解密了两次,其解密的方法是:
private final static String[] hex = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" }; private final static byte[] val = { 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F }; public static String escape(String s) { StringBuffer sbuf = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i++) { int ch = s.charAt(i); if (ch == ' ') { // space : map to '+' sbuf.append('+'); } else if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' : as it was sbuf.append((char) ch); } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' : as it was sbuf.append((char) ch); } else if ('0' <= ch && ch <= '9') { // '0'..'9' : as it was sbuf.append((char) ch); } else if (ch == '-' || ch == '_' // unreserved : as it was || ch == '@' || ch == '.' || ch == '!' || ch == '~' || ch == '*' || ch == '\'' || ch == '(' || ch == ')') { sbuf.append((char) ch); } else if (ch <= 0x007F) { // other ASCII : map to %XX sbuf.append('%'); sbuf.append(hex[ch]); } else { // unicode : map to %uXXXX sbuf.append('%'); sbuf.append('u'); sbuf.append(hex[(ch >>> 8)]); sbuf.append(hex[(0x00FF & ch)]); } } return sbuf.toString(); } public static String unescape(String s) { StringBuffer sbuf = new StringBuffer(); int i = 0; int len = s.length(); while (i < len) { int ch = s.charAt(i); if (ch == '+') { // + : map to ' ' sbuf.append('+'); } else if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' : as it was sbuf.append((char) ch); } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' : as it was sbuf.append((char) ch); } else if ('0' <= ch && ch <= '9') { // '0'..'9' : as it was sbuf.append((char) ch); } else if (ch == '-' || ch == '_' // unreserved : as it was || ch == '.' || ch == '!' || ch == '@' || ch == '~' || ch == '*' || ch == '\'' || ch == '/' || ch == '(' || ch == ')') { sbuf.append((char) ch); } else if (ch == '%') { int cint = 0; if ('u' != s.charAt(i + 1)) { // %XX : map to ascii(XX) cint = (cint << 4) | val[s.charAt(i + 1)]; cint = (cint << 4) | val[s.charAt(i + 2)]; i += 2; } else { // %uXXXX : map to unicode(XXXX) cint = (cint << 4) | val[s.charAt(i + 2)]; cint = (cint << 4) | val[s.charAt(i + 3)]; cint = (cint << 4) | val[s.charAt(i + 4)]; cint = (cint << 4) | val[s.charAt(i + 5)]; i += 5; } sbuf.append((char) cint); } i++; } return sbuf.toString(); }
- jquery.autocomplete.zip (7.6 KB)
- 下载次数: 36
发表评论
-
模仿QQ邮箱,邮箱地址输入框
2014-03-21 16:29 1442加入我上一篇修改过的jQuery.autocomplete.j ... -
WEB开发中遇到的问题
2013-08-26 16:12 9501. Failed to load or instantiat ... -
java中拷贝删除文件或目录,
2013-08-20 08:38 884// 复制文件 public stati ... -
根据svn的ChangeLog打出更新包
2013-08-15 17:24 2149ChangeLog.txt r628 | zhoulz | ... -
简单又好用的Tomcat 页面权限控制
2013-08-08 09:02 1298不废话,就2个配置文件,直接上代码。 web.xml &l ... -
hibernate中OneToMany双向关联,不生成连接表,级联增删改配置
2013-04-08 15:29 6515One方配置: @OneToMany(fetch = Fet ... -
在jsp页面中,巧用struts2中的标签
2013-03-06 16:36 11601、set标签 <s:iterator value ... -
ibatis中 #和$的区别
2012-09-26 15:00 945据我理解是这样的 #是把传入的数据做类型转换,如果转换后拼接 ... -
a different object with the same identifier value was already associated with th
2012-09-26 11:13 1603原因:在保存(更新)对象newObj之前,已经通过id用get ... -
jQuery 中的center居中方法
2012-07-30 10:14 1265jQuery.fn.center = functio ... -
object references an unsaved transient instance - save the transient instance be
2012-07-27 11:16 1578今天在重构公司一个老项目的时候,遇到了这个异常,记录下: 很明 ... -
IE下iframe内的文本框无法聚焦输入
2012-07-18 13:40 1844前些天在制作一个 jQuery 插件 Openbox 的时候, ... -
spring+ehcache应用
2012-06-20 14:14 4172首页发现篇,虽然跟我的不一样,但思路大致相同,大家可以参考下咯 ... -
(apache)mod_proxy 和 mod_rewrite实现js跨域
2011-12-15 15:08 3265项目中用到了,于是搞了几多时间,还是没太明白,只是会基本用法, ... -
关于正则表达式,搜索指定字符串,类似like查询
2011-12-08 10:31 1831需求: 1、搜索带有关键字的数组字符串,有点类型DB中的lik ...
相关推荐
用java实现autocomplete搜索功能,可以获取除输入框的其它动态参数,后台字符串拼接,返回json数据,格式如下: { query:'Li', suggestions:['Liberia', 'Libyan Arab Jamahiriya', 'Liechtenstein', 'Lithuania'...
本教程将详细介绍如何结合Jquery.AutoComplete插件和微软的ChineseConverter.dll库,实现在网页上进行汉字、拼音和简拼的模糊搜索功能。 首先,Jquery.AutoComplete是jQuery UI库中的一个组件,它能为输入框添加...
jQuery Autocomplete默认支持上下键移动,用户可以通过上/下箭头键选择提示列表中的项目。如果需要自定义行为,可以通过监听`keydown`事件进行扩展。 ```javascript $("#searchInput").on('keydown', function...
总之,通过自定义`jquery.autocomplete`的查询源函数,我们可以实现更复杂、更个性化的查询策略,比如支持拼音首字母查询和多关键字查询,从而提高用户体验。结合提供的CSS和HTML文件,我们可以构建出美观且功能强大...
**jQuery AutoComplete** 是一个非常流行的JavaScript库,用于在输入框中实现自动补全功能,它极大地提高了用户体验,尤其在需要用户输入关键字进行搜索或筛选的场景中。这个功能是基于jQuery框架构建的,因此可以...
本文将深入探讨jQuery Autocomplete的实现原理、兼容性、中文支持以及如何与JSON数据源结合使用。 ### 1. 实现原理 jQuery Autocomplete主要通过监听用户在输入框中的输入事件,实时发送AJAX请求到服务器获取匹配...
《jQuery.Autocomplete 中文支持详解》 jQuery.Autocomplete 是一个广受欢迎的 jQuery 插件,它提供了输入框的自动完成和建议提示功能,极大地增强了用户体验。该插件允许通过 AJAX 方式动态加载数据,使得实时搜索...
在使用 jQuery Autocomplete 实现中文搜索时,我们需要确保数据源(通常是JSON格式)包含了正确的编码,通常为UTF-8。同时,要确保HTML页面的meta标签也指定了正确的字符集,例如`<meta charset="UTF-8">`。这样,...
在标题提到的问题中,“jquery-easyui的combobox火狐下不支持中文匹配”,这是一个常见的问题,因为原生的EasyUI Combobox可能并未充分考虑跨浏览器的兼容性,特别是在处理中文字符的搜索和匹配上。Firefox和其他...
### 支持中文的关键点 1. **字符编码**:由于中文字符的特殊性,确保服务器和客户端之间的字符编码一致非常重要。通常需要设置UTF-8编码以正确处理中文。 2. **数据格式化**:Autocomplete的数据源可以是JSON格式...
1. **中文支持**:autocomplete.js 支持中文字符,无论是简体还是繁体,都能进行有效的补全,满足中文环境下的应用需求。 2. **中间字查询**:不同于传统的首字母匹配,该插件支持用户输入任意中间字进行查询,提高...
**解决中文显示问题** 是jQuery Autocomplete的一个关键特性。由于JavaScript默认编码问题,中文字符在某些情况下可能无法正确显示。本压缩包中的源代码已经解决了这个问题,确保在自动提示列表中,中文可以正确无误...
通常,我们需要对数据源进行编码处理,使其支持中文搜索。 例如,如果数据源是从服务器异步获取的,需要确保服务器返回的JSON数据正确编码,如使用UTF-8编码。同时,前端处理数据时也要保持相同的编码规则。 ```...
1. **中文匹配**:确保你的数据源支持中文字符,同时在设置 `source` 时处理好中文编码问题。 2. **性能优化**:对于大量数据,考虑使用异步加载或缓存策略,以避免性能瓶颈。 3. **自定义样式**:可以通过 CSS 调整...
本项目"autocomplete汉字与拼音的双重查询"特别关注了中文环境下的应用,不仅支持基于汉字的自动补全,还同时考虑了拼音的匹配,使得用户在输入汉字或拼音时都能得到准确的建议。 首先,我们要理解的是`...
本篇文章将深入探讨一个基于jQuery的Autocomplete插件,它支持GB2312和UTF-8编码,对于中文环境有着良好的适应性。 jQuery Autocomplete插件是jQuery UI库中的一个重要组件,它为文本输入框提供了自动完成的功能。...
对于支持中文,我们需要处理的是汉字字符集,这与英文字符处理有所不同。在C#或PHP中,可以使用Unicode编码来处理中文字符,确保程序能够正确识别和处理中文。 在C#中,可以利用`System.Windows.Forms....
- **中文支持**:插件可以处理中文字符,适合中文检索场景。 - **自定义数据源**:可以绑定到数组、JSON 数据、AJAX 请求等多种数据源。 - **多种样式和布局**:可以通过 CSS 自定义显示样式,适应不同设计需求。 - ...
- **AUTOCOMPLETE(自动补全)**: 在输入框中提供动态的建议列表,提高输入效率,常用于搜索框和表单输入。 ### 2. 使用jQuery UI的步骤 1. **引入库文件**:首先在HTML文件中引入jQuery库和jQuery UI的CSS与JS...