WEB开发网
开发学院WEB开发Jsp 使用java应用程序提交表单 阅读

使用java应用程序提交表单

 2009-12-18 21:11:03 来源:WEB开发网   
核心提示:URL url = new URL(urlString);URLConnection connection = url.openConnection();connection.setDoOutput(true);PRintWriter out = new PrintWriter(connection.getOutput
URL url = new URL(urlString);
   URLConnection connection = url.openConnection();
   connection.setDoOutput(true);

   PRintWriter out = new PrintWriter(connection.getOutputStream());

   boolean first = true;
   for (Map.Entry<String, String> pair : nameValuePairs.entrySet())
   {
     if (first) first = false;
     else out.print('&');
     String name = pair.getKey();
     String value = pair.getValue();
     System.out.println(name);
     System.out.println(value);
     out.print(name);
     out.print('=');
     out.print(URLEncoder.encode(value, "UTF-8"));
   }

   out.close();



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/helloxtayfnje/archive/2009/12/17/5026608.aspx

Tags:使用 java 应用程序

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接