struts的json数据接收解析
json格式
/*** 类描述:接收json数据修改延期时间** @ClassName BankManageMent* @Description TODO* @Author 张 * @Date * @Version 1.0*/public ActionForward DelayTime(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException{int contentLength = request.getContentLength();if(contentLength<0){return null;}byte buffer[] = new byte[contentLength];for (int i = 0; i < contentLength;) {int len = request.getInputStream().read(buffer, i, contentLength - i);if (len == -1) {break;}i += len;}System.out.println("1111111"+new String(buffer, "utf-8"));//打印数据List<Map> specsList = com.alibaba.fastjson.JSONObject.parseArray(new String(buffer, "utf-8"), Map.class);for (Map info : specsList) {String fxtfhth = (String) info.get("fxtfhth");String xttqsdate = (String) info.get("xttqsdate");String xttqedate = (String)info.get("xttqedate");String xtqreason = (String)info.get("xtqreason");System.out.println(fxtfhth);System.out.println(xttqsdate);System.out.println(xttqedate);System.out.println(xtqreason);System.out.println("-========-");BankManageMentBo bankManageMentBo=new BankManageMentBo();String s = bankManageMentBo.DelayTime(fxtfhth,xttqsdate,xttqedate,xtqreason);if ("suc"==s){String suc="修改成功";response.setHeader("Pragma", "no-cache");response.setHeader("Cache-Control", "no-cache");response.setDateHeader("Expires", 0);response.setContentType("application/json;charset=UTF-8");response.getWriter().write(suc);response.getWriter().flush();response.getWriter().close();}else{String error="修改失败";response.setHeader("Pragma", "no-cache");response.setHeader("Cache-Control", "no-cache");response.setDateHeader("Expires", 0);response.setContentType("application/json;charset=UTF-8");response.getWriter().write(error);response.getWriter().flush();response.getWriter().close();}}return null;}
service
public String DelayTime(String fxtfhth, String xttqsdate, String xttqedate, String xtqreason) {//要执行的语句String user = "update xtmistq e set e.xttqsdate=to_date('"+xttqsdate+"','yyyy-mm-dd'),e.xttqedate=to_date('"+xttqedate+"','yyyy-mm-dd'),e.xtqreason='"+xtqreason+"' where e.fxtfhth='"+fxtfhth+"'";System.out.println(user);String k="suc";try {DBHelper db = new DBHelper();db.execute(user);} catch (Exception e) {k="error";// TODO Auto-generated catch blocke.printStackTrace();}return k;}
struts的json数据接收解析相关推荐
- c语言json映射,GitHub - xujun621/cson: 基于C语言的json数据映射解析库
CSON 基于cJSON,运行于C语言平台的json-struct模型解析工具 简介 CSON是一个简单的cJSON的二次封装,相比于使用原生cJSON一层一层解析的方式,CSON采用模型映射的方式, ...
- layui 传递前端请求_Layui数据表格 前后端json数据接收的方法
先上效果图: 前端数据表格: 编号菜单名称菜单路径菜单图标菜单子菜单操作 编辑 删除 js代码 $(function () { //注意:这里是数据表格的加载数据,必须写 layui.use(['ta ...
- android json.out,Android 之 json数据的解析(jsonReader)
json数据的解析相对而言,还是比较容易的,实现的代码也十分简单.这里用的是jsonReade方法来进行json数据解析. 1.在解析之前,大家需要知道什么是json数据. json数据存储的对象是无 ...
- C#获取http请求的JSON数据并解析
文章目录 1️⃣ C#获取http请求的JSON数据并解析 1.1 获取http的JSON数据 1.2 解析JSON数据 优质资源分享 C#获取http请求的JSON数据并解析,第一步,先拿到http ...
- 利用百度APIStoreSDK获取Json数据并解析加载到ListView上
效果图(这里只是截取了List中的一项): 一.:登录百度ApiStore,获取移动sdk Android版(同时有使用文档和示例),将jar包导入到项目中 Android Studio请在放入lib ...
- swift php json解析,Swift 4.0 | JSON数据的解析和编码
文 / 菲拉兔 自己撸的图 要求: Platform: iOS8.0+ Language: Swift4.0 Editor: Xcode9 [问题补充2017-09-28] 最近我发现了一个问题:在S ...
- Android studio获取服务器端json数据并解析
最近在做Android的一个项目,涉及到Android studio与服务器端通信问题,在网上看了很多,找到了一些解决办法,这篇文章就简单介绍一下如何获取以及向服务器上传json数据. 在这个项目中, ...
- Flutter 项目编写 第三方插件库文件引入,本地图片 json数据引入解析
FlutterDemo是如何一步一步搭建起来的 最初就是直接新建flutter项目,就会自动建立一个入门项目.(开始项目前,需先学习Dart语言) flutter项目代码都在lib目录下编写: 新建包 ...
- JavaScript——JSON数据和解析
1.JSON(JavaScript Object Notation, JS对象简谱)是一种轻量级的数据交换格式.它基于 ECMAScript(European Computer Manufacture ...
最新文章
- 算法设计与分析 1 递推与递归
- cookie和session 创建和验证 原始的servlet
- python贴吧发帖脚本-分享用Python写的99收抢单小脚本,仅供学习
- 【技术分享】京东电商广告和推荐的机器学习系统实践
- java的xms与xmx和服务器内存_JAVA_OPTS参数-Xms和-Xmx的作用
- swift中的@objc
- integer比较_每日一题:Integer、int 的区别
- AngularJS HTML DOM
- R语言分类算法之线性判别分析(Linear Discriminant Analysis)
- 字节跳动:高级人才的五个基本素质
- Hutool你值得拥有,吃相不要太难看
- Canvas线条动画
- java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id null 	at org.spr
- python制作股票图表-专题:Python matplotlib 绘制股票走势图
- elasticsearch(15) match_phase的使用 slop的使用
- pico-ctf-2013 overflow-2
- 数据加密 RSA非对称加密篇
- 海康摄像头opencv实时回调
- 3D Object Detection 3D目标检测综述
- 手游《六大门派》 武侠MMORPG手机游戏全套源码下载