赞
踩
- StringBuilder sb = new StringBuilder();
- try (BufferedReader reader = request.getReader();) {
- char[] buff = new char[1024*1024];
- int len;
- while ((len = reader.read(buff)) != -1) {
- sb.append(buff, 0, len);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- public String splitString(String str, String temp) {
- String result = null;
- if (str.indexOf(temp) != -1) {
- if (str.substring(str.indexOf(temp)).indexOf("&") != -1) {
- result = str.substring(str.indexOf(temp)).substring(str.substring(str.indexOf(temp)).indexOf("=") + 1,
- str.substring(str.indexOf(temp)).indexOf("&"));
-
- } else {
- result = str.substring(str.indexOf(temp)).substring(str.substring(str.indexOf(temp)).indexOf("=") + 1);
-
- }
- }
- return result;
- }
- String 参数= request.getParameter("参数"); //
- if (判断参数是否为空) {
- StringBuilder sb = new StringBuilder();
- try (BufferedReader reader = request.getReader();) {
- char[] buff = new char[1024*1024];
- int len;
- while ((len = reader.read(buff)) != -1) {
- sb.append(buff, 0, len);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- 参数= this.splitString(sb.toString(), "参数=");
- }
- String 参数= request.getParameter("参数"); //
- if (判断参数是否为空) {
- StringBuilder sb = new StringBuilder();
- try (BufferedReader reader = request.getReader();) {
- char[] buff = new char[1024*1024];
- int len;
- while ((len = reader.read(buff)) != -1) {
- sb.append(buff, 0, len);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- 参数 = this.splitString(sb.toString(), "参数=");
- 参数 = URLDecoder.decode(参数,"UTF-8");
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。