/ ** File Name: OpenURL.JAVA Description: Access a page via the java.net.url class, and return the result ** / import java.net. *; Import java.io. *; public class openurl {public string getContent Strince) // A public method, returns a string, an error returns "ERROR OPEN URL" {Try {URL URL = New URL (StrURL); BufferedReader Br = New BufferedReader (Url.OpenStream ()))); String s = ""; stringbuffer sb = new stringbuffer (""); while ((s = br.readline ())! = Null) {sb.append (s "/ r / n");} br.close Return Sb.toString ();} catCH (Exception E) {Return "Error Open URL" StrURL;}} public static void main (String args []) {// Specific User OpenURL OU = New OpenURL () System.out.println (oo.getcontent ("http://127.0.0.1");}}} example:
<% @ page language = "java" contenttype = "text / html; charSet = GB2312" PageEncoding = "GB2312"%> <% @ include file = "./ ini / incd.jsp"%> < % @ page import = "java.net. *"%> < Meta name = "generator" content = "ibm WebSphere Studio">