1. 程式人生 > >java讀取request中的xml

java讀取request中的xml

java讀取request中的xml

 

 

答:

// 讀取xml

InputStream inputStream;

StringBuffer sb = new StringBuffer();

inputStream = request.getInputStream();

String s;

BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));

while ((s = in.readLine()) != null) {

sb.append(s);

}

in.close();

inputStream.close();