当前位置: 首页 > news >正文

网站空间租赁自建网站网址

网站空间租赁,自建网站网址,外贸建站模板价格,公司注册一站式ajax参数传递与后台接收Servlet中读取http参数的方法Enumeration getParameterNames() 返回一个 String 对象的枚举#xff0c;包含在该请求中包含的参数的名称String getParameter(String name) 以字符串形式返回请求参数的值#xff0c;或者如果参数不存在则返回 null。Str…ajax参数传递与后台接收Servlet中读取http参数的方法Enumeration getParameterNames() 返回一个 String 对象的枚举包含在该请求中包含的参数的名称String getParameter(String name) 以字符串形式返回请求参数的值或者如果参数不存在则返回 null。String getQueryString() 返回包含在路径后的请求 URL 中的查询字符串。String[] getParameterValues(String name) 返回一个字符串对象的数组包含所有给定的请求参数的值如果参数不存在则返回 null。ServletInputStream getInputStream() 使用 ServletInputStream以二进制数据形式检索请求的主体。ajax默认contentType为application/x-www-form-urlencoded使用默认contentType参数追加到url后传递$.ajax({url: http://localhost:8082/boot/request/parameter?nameaaaparaBbbb,contentType: application/x-www-form-urlencoded;charsetutf-8,success: function(json){console.log(json);}});//请求中包含的参数的名称Enumeration parameterNames request.getParameterNames();while (parameterNames.hasMoreElements()) {String s parameterNames.nextElement();System.out.println(getParameterNames: s);String paraA request.getParameter(s);System.out.println(getParameter: paraA);}// 返回包含在路径后的请求 URL 中的查询字符串String queryString request.getQueryString();System.out.println(getQueryString: queryString);使用默认contentType参数放到data中传递$.ajax({url: http://localhost:8082/boot/request/parameter,contentType: application/x-www-form-urlencoded;charsetutf-8,data: {name: aaa, paraB:bbb},success: function(json){console.log(json);}});//请求中包含的参数的名称Enumeration parameterNames request.getParameterNames();while (parameterNames.hasMoreElements()) {String s parameterNames.nextElement();System.out.println(getParameterNames: s);String paraA request.getParameter(s);System.out.println(getParameter: paraA);}使用默认contentTypedata中传递数组$.ajax({url: http://localhost:8082/boot/request/parameter,type: post,contentType: application/x-www-form-urlencoded;charsetutf-8,data: {foo: [bar1, bar2]},success: function (json) {console.log(json);}});// 返回一个字符串对象的数组String[] parameterValues request.getParameterValues(foo[]);if (parameterValues ! null) {for (String parameterValue : parameterValues) {System.out.println(getParameterValues: parameterValue);}}使用contentType为application/json在data中传递复杂参数$.ajax({url: http://localhost:8082/boot/request/parameter,type: post,contentType: application/json;charsetutf-8,data: JSON.stringify({name: aaa, foo: [bar1, bar2]}),success: function (json) {console.log(json);}});// 以二进制数据形式检索请求的主体ServletInputStream inputStream request.getInputStream();BufferedReader br new BufferedReader(new InputStreamReader(inputStream));String line ;StringBuilder sb new StringBuilder();while ((line br.readLine()) ! null) {sb.append(line);}System.out.println(getInputStream: sb);使用contentType为application/json在data中传递复杂参数并使用springmvc接收$.ajax({url: http://localhost:8082/boot/request2/requestBody,type: post,contentType: application/json;charsetutf-8,data: JSON.stringify({id: 111, name: aaa, foo: [bar1, bar2]}),success: function (json) {console.log(json);}});RequestMapping(value /requestBody)public void RequestBody(RequestBody User user) throws IOException {System.out.println(user.toString());}url追加参数与data中放json同时使用$.ajax({// url: http://localhost:8082/boot/request/parameter?userNameaaa,url: http://localhost:8082/boot/request2/parm?userNameaaa,type: post,contentType: application/json;charsetutf-8,data: JSON.stringify({id: 111, name: aaa, foo: [bar1, bar2]}),async:false,success: function (json) {console.log(json);}});//请求中包含的参数的名称Enumeration parameterNames request.getParameterNames();while (parameterNames.hasMoreElements()) {String s parameterNames.nextElement();System.out.println(getParameterNames: s);String paraA request.getParameter(s);System.out.println(getParameter: paraA);}// 以二进制数据形式检索请求的主体ServletInputStream inputStream request.getInputStream();BufferedReader br new BufferedReader(new InputStreamReader(inputStream));String line ;StringBuilder sb new StringBuilder();while ((line br.readLine()) ! null) {sb.append(line);}System.out.println(getInputStream: sb);RequestMapping(value /parm)public void parm(RequestParam String userName, RequestBody User user) throws IOException {System.out.println(userName: userName);System.out.println(user.toString());}
http://www.pierceye.com/news/627379/

相关文章:

  • 塔里木油田公司档案馆网站建设研究响应式网站建设教程
  • wordpress侧边栏怎么加php代码重庆seo优化公司
  • 自做建材配送网站做的比较好的游戏网站
  • 建设网站公司兴田德润在哪里秦皇岛海港区
  • 做网站阜阳百度投放广告
  • 北京互联网金融公司排名网站栏目优化
  • 教育网站解决方案用wordpress制作表单
  • 整站wordpress下载phpcms 网站标题
  • 湛江市建设局官网站品牌网络营销方法分析
  • 做网站数据库表各字段详情福建省港航建设发展有限公司网站
  • 潍坊 营销型网站建设游戏设计师网站有哪些
  • 用花生棒做网站快吗大型网站开发合同
  • 网站建设什么原因最主要wordpress mu安装
  • 龙岗网站设计公司价格wordpress商品属性选择
  • 企业网站如何优化足球比方类网站开发
  • 大型网站开发 优帮云公司制度建设的意义
  • 收录网站工具沈阳高端网站定制
  • 做网站哪家比较好网站网页翻页设计
  • 湖州建设网站制作手机网站登录模板
  • 重庆网站制作技术wordpress获取特定尺寸特征图像
  • 展示型网站建设标准网络组建视频
  • 怎么用wordpress建手机网站网络管理网站策划书
  • 网站空间位置河南郑州百姓网
  • 云服务器可以用来做网站么网站建设短期培训
  • 做网站的费属于什么费用昆山智能网站开发
  • 西安网站制作南昌公司企业微信app下载安装官方版
  • 网站建设情况总结个人静态网页学生作业
  • 手机网站一键分享到微信asp.net ftp发布网站
  • 重庆网站制作公司妇联加强网站平台建设
  • php mysql网站开发全程实例.pdf网站的视频怎么下载