File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Webpage source code
Joined: Feb 09, 2006
Apr 07, 2006 13:01:00
Is there any way to get a webpages source code using jsp? For example I want my jsp page to get the source code of lets say
and write it to a file, how can I do this? thanks.
Joined: Sep 23, 2004
Apr 07, 2006 13:25:00
Your best bet would be to look at
Apache Commons HttpClient
library. This makes it very simple to get a URL. It also handles things like cookies and authentication.
<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Joined: Mar 22, 2005
Apr 07, 2006 13:40:00
And of you want to process the page you got, have a look into HttpUnit (on SourceForge), which will give you a DOM view of the page. That way you can use the DOM API or XPath to get at the contents of the page.
Ping & DNS
- my free Android networking tools app
It is sorta covered in the
JavaRanch Style Guide
subject: Webpage source code
Server URL call issues in jsp/struts
Q for Kathy & Bert
Creating Java classes on fly
"Type mismatch: cannot convert from Cookie to String"
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014