Author
Is there a way to read HTML into a string from a URL
Fritz Largosa
Ranch Hand
Joined: Sep 12, 2005
Posts: 70
For example I want a method which accepts a url and returns the html source of the target page. Anybody know if this can be done? Any documentations I can read or sample codes? I do not seem to find any information regarding this. Pseudocode: String html_source = method_get_html_source("http://www.my_page/page1.html");
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
Yes, but as this has nothing to do with JSP , I'll first move this to the Servlets forum.
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
Investigate the URL and URLConnection classes, or save yourself some trouble and look up the HttpClient project.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
Or, are you really trying to do this from a JSP rather than with java code? (and without java code in a JSP which is a no-no)
Fritz Largosa
Ranch Hand
Joined: Sep 12, 2005
Posts: 70
Ok I will look that up, I can use either servlet or JSP. Thanks.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35427
posted Aug 03, 2007 17:19:00
0
It could be as simple as:
Android apps – ImageJ plugins – Java web charts
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
In a JSP, look into <c:import>.
subject: Is there a way to read HTML into a string from a URL