接着在https://www.cnblogs.com/dong973711/p/10907733.html的基础上做验证. 从前端提交数据 前端页面,submit.html <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>用AJAX以JSON方式提…
跳过struts2环境搭建部分,或者可以看我的博客(http://www.cnblogs.com/zhangky/p/8436472.html),里面有写,很详细. 需要导入的jar包(struts官网有,自己下) 一.java类 private String username; private String pwd; private Map<String, Object> result; public String getUsername() { return username; } pub…
使用JDBC,json工具使用的org.json /** * ResultSet转JSON * * @param rs * @return * @throws SQLException * @throws JSONException */ public static JSONArray resultSetToJson(ResultSet rs) throws SQLException, JSONException, UnsupportedEncodingException { // json数组…
脚本如下: #!/bin/bash mysql -s -phello test >.log <<EOF desc t1; EOF lines="concat_ws(','," count=`.log|wc -l` linenum= while read line do coloumname=`echo $line |awk '{print $1}'` let linenum=linenum+ ];then lines=$lines"concat_ws(':'…
如图需要获取下面两个li标签里面的数据,然后传给后台:而后台接收的数据格式是json的,所以需要把两个li里面的信息转化为以下格式的. {recieverName:小红,recieverPhone:12341234,recieverAddress:中国湖南},{recieverName:小明,recieverPhone:12345678,recieverAddress:中国上海} 代码如下: var recieverArr = []; //全局变量 var recieverMsg = {}; /…
(原文地址:http://xuzhihong1987.blog.163.com/blog/static/26731587201101853740294/) LINQ查询返回DataTable类型 在使用LINQ查询的时候,一般我们会返回List<T>或IList<T>类型,如下所示: 例1: public List<TSample> GetList() { using (BPDataContext db = newBPDataContext(TCTC_Connectio…
在我们进入主题前,我先先看下获取网址URL的方法: window.location.href // 设置或获取整个URL为字符串 window.location.hash // 设置或获取href属性中在井号#后面的部分参数 window.location.search // 设置或获取href属性中跟在问号?后面,井号#前面的部分参数 例如我们这里有一个url,例如:http://127.0.0.1:8080/html/urltojson.html?id=1&name=good#&pri…
# coding=utf-8 ''' Created on 2016-10-26 @author: Jennifer Project:读取mysql数据库的数据,转为json格式 ''' import json,MySQLdb def TableToJson(): try: #1-7:如何使用python DB API访问数据库流程的 #1.创建mysql数据库连接对象connection #connection对象支持的方法有cursor(),commit(),rollback(),close…
查看一个简单的jQuery的例子来遍历一个JavaScript数组对象. var json = [ {"id":"1","tagName":"apple"}, {"id":"2","tagName":"orange"}, {"id":"3","tagName":"banana&q…
利用python将excel数据解析成json格式 转成json方便项目中用post请求推送数据自定义数据,也方便测试: import xlrdimport jsonimport requests def openWorkbook(): # 读取excel表的数据 workbook = xlrd.open_workbook(r'D:\data.xlsx') # 选取需要读取数据的那一页 sheet = workbook.sheet_by_index(0) # 获得行数和列数 rows = she…