一、在java中调用url,并打开一个新的窗口
String url="http://10.58.2.131:8088/spesBiz/test1.jsp";
String cmd = "cmd.exe /c start " + url;
try {
Process proc = Runtime.getRuntime().exec(cmd);
proc.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}
二、在java中调用url,后台调用。并取得返回值
URL U = new URL("http://10.58.2.131:8088/spesBiz/test1.jsp");
URLConnection connection = U.openConnection();
connection.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine())!= null)
{
result += line;
}
in.close();