Home > Web Front-end > JS Tutorial > Jsp capture page content

Jsp capture page content

巴扎黑
Release: 2016-12-20 14:30:36
Original
1460 people have browsed it

<%@ page contentType="text/html;charset=gb2312"%>
<% 
String sCurrentLine; 
String sTotalString; 
sCurrentLine=""; 
sTotalString=""; 
java.io.InputStream l_urlStream; 
java.net.URL l_url = new java.net.URL("http://www.baidu.com/"); 
java.net.HttpURLConnection l_connection = (java.net.HttpURLConnection) l_url.openConnection(); 
l_connection.connect(); 
l_urlStream = l_connection.getInputStream(); 
java.io.BufferedReader l_reader = new java.io.BufferedReader(new java.io.InputStreamReader(l_urlStream)); 
while ((sCurrentLine = l_reader.readLine()) != null) 
{ 
sTotalString+=sCurrentLine; 
} 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<table align="center">
<tr>
<td colspan="2">
<textarea name="content" id="content"
style="width: 500px; height: 300px;" rows="1" cols="20">
<%=sTotalString %>
</textarea>
</td>
</tr>
</table>
</body>
</html>
Copy after login


Related labels:
jsp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template