public void printerInfo() { System.out.println("爱的发发达发达的说"); URL url = null; String uslStr = "http://192.168.0.106:8080/manage/typer/save.shtml"; try { url = new URL(uslStr); try { PrecisionPrint precisionPrint = new PrecisionPrint(); JSONObject jsonObject = precisionPrint.getPrintMSg(); URLConnection urlConnection = url.openConnection(); urlConnection.setRequestProperty("content-type", "application/x-www-form-urlencoded"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); OutputStream out = urlConnection.getOutputStream(); out.write(jsonObject.toString().getBytes("utf-8")); out.flush(); out.close(); // 从服务器读取响应 // InputStream inputStream = urlConnection.getInputStream(); //String body = IOUtils.toString(inputStream, "utf-8"); //System.out.println("返回的值是:" + body); } catch (Exception e) { e.printStackTrace(); } } catch (MalformedURLException e) { e.printStackTrace(); }}
添加回答
举报
0/150
提交
取消