zoukankan      html  css  js  c++  java
  • 接收请求并处理,再将结果返回给调用者


    //返回的xml消息体(用在servlet中) 
            String  backXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?

    ><root><code>0</code><name>www</name></root>";
      
     sendCompressDate(resp, backXml);
     


    public static void sendCompressDate(HttpServletResponse response,
       String result)
     {
      BufferedWriter out = null;
      try
      {
       out = new BufferedWriter(new OutputStreamWriter(response
         .getOutputStream(), "UTF-8"));
       out.write(result);
       out.flush();
      } catch (IOException e)
      {
       e.printStackTrace();
      } catch (Exception e)
      {
       e.printStackTrace();
      } finally
      {
       try
       {
        if (out != null)
        {
         out.close();
         out = null;
        }
       } catch (IOException e)
       {
        out = null;
       }
      }
     }

  • 相关阅读:
    HTML入门之003
    html入门之002
    HTML入门之001
    端口
    计算机基础
    二进制的学习
    markdown基础
    css基础
    html基础之三
    html基础之二
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3136966.html
Copyright © 2011-2022 走看看