一个网站,我读了检索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