关于网友提出的“ 在jsp页面上显示下面的内容”问题疑问,本网通过在网上对“ 在jsp页面上显示下面的内容”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 在jsp页面上显示下面的内容
描述: public class Main {
public static void main(String[] args) throws Exception {
// Create and initialize HTTP parameters
HttpParams params = new BasicHttpParams();
ConnManagerParams.setMaxTotalConnections(params, 100);
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(
new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
HttpClient httpClient = new DefaultHttpClient(cm, params);
// create an array of URIs to perform GETs on
String[] urisToGet = {
"http://www.baidu.com",
"http://www.sohu.com"
};
// create a thread for each URI
GetThread[] threads = new GetThread[urisToGet.length];
try{
for (int i = 0; i < threads.length; i++) {
HttpGet httpget = new HttpGet(urisToGet[i]);
threads[i] = new GetThread(httpClient, httpget, i + 1);
}
// start the threads
for (int j = 0; j < threads.length; j++) {
threads[j].start();
}
// join the threads
/>
for (int j = 0; j < threads.length; j++) {
threads[j].join();
}
}finally {
httpClient.getConnectionManager().shutdown();
}
}
/**
* A thread that performs a GET.
*/
public static class GetThread extends Thread {
/>
private final HttpClient httpClient;
private final HttpContext context;
private final HttpGet httpget;
private final int id;
public GetThread(HttpClient httpClient, HttpGet httpget, int id) {
this.httpClient = httpClient;
this.context = new BasicHttpContext();
this.httpget = httpget;
this.id = id;
}
/**
* Executes the GetMethod and prints some status information.
*/
@Override
public void run() {
System.out.println(id + " - about to get something from " + httpget.getURI());
try {
HttpResponse response = httpClient.execute(httpget, context);
System.out.println(id + ":" +response.getStatusLine());
} catch (Exception e) {<>
httpget.abort();
System.out.println(id + " - error: " + e);
}
}
}
}
上面红色的部分,怎么在jsp页面上显示出来啊,我是新手,最好有写出代码,谢谢了!!!
/>
以上介绍了“ 在jsp页面上显示下面的内容”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2146020.html