一個網站,我讀了檢索Java中的網頁,它是快速的使用方法:檢索添加了用戶輸入
URL url = new URL("http://example.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
InputStream stream = connection.getInputStream();
// read the contents using an InputStreamReader
但我怎麼添加用戶到URL給一個變量?例如:
用戶輸入x 加載頁面http://example.com/x.php
我是新來的Java,所以任何幫助,將不勝感激。
我記得有可能在Java中連接兩個字符串爲多,不能使用這種技術? url + inputString成一個新的URL變量,這對你有意義嗎? – Bastardo 2011-04-08 13:33:14