try {
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
InputStream inputStream;
inputStream = request.getInputStream();
String strMessage = "";
String strResponse = "";
BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(inputStream,"utf-8"));
while ((strMessage = reader.readLine()) != null) {
strResponse += strMessage;
}
reader.close();
System.out.println(strResponse);
inputStream.close();
//返回信息的部分
PrintWriter printWriter = response.getWriter(); printWriter.write("SUCCESS"); printWriter.flush(); printWriter.close();
} catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 原文链接:https://www.f2er.com/xml/295652.html