aspose file tools*
The moose likes Servlets and the fly likes Getting HTML code from servlets ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting HTML code from servlets ? " Watch "Getting HTML code from servlets ? " New topic
Author

Getting HTML code from servlets ?

Zeusman Rana
Greenhorn

Joined: Nov 10, 2003
Posts: 2
Hi,
Im facings problems regarding fetching the HTML code of a website from a Servlet.
I have used URLConnection for that. It seems to work for simple URL's such...http://www.hotmail.com
but not for pages on unix accounts eg. http://www-scf.usc.edu/~cs571
Please i dont understand the difference between the two.
Also is there any other way to solve this problem so that it works for all types of URL's.
Thanks in advance,
Regards,
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Does the URL work in a browser? I tried clicking the link and got "The requested URL /~cs571 was not found on this server." There shouldn't be any difference in the way you access the two in Java.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Zeusman Rana
Greenhorn

Joined: Nov 10, 2003
Posts: 2
oops sorry the url is http://www-scf.usc.edu/~csci571
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
i suspect your problem may be because that link uses frames! the html for a framed page is actually a top level frame which tells the layout and the content of the pages are actually seperate requests! however i do not know what you can do about it, sorry, i hope i have found the problem though


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Irudaya Joseph
Greenhorn

Joined: Sep 23, 2003
Posts: 1
Originally posted by Zeusman Rana:
Hi,
Im facings problems regarding fetching the HTML code of a website from a Servlet.
I have used URLConnection for that. It seems to work for simple URL's such...http://www.hotmail.com
but not for pages on unix accounts eg. http://www-scf.usc.edu/~cs571
Please i dont understand the difference between the two.
Also is there any other way to solve this problem so that it works for all types of URL's.
Thanks in advance,
Regards,
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
Where there is a problem there must be a solution.
Type in the following to your browser address, then go to view -> source and view the html code...It worked for me.
http://www-scf.usc.edu/~csci571/2003Fall/home.html
You can also type in http://www-scf.usc.edu/~csci571/2003Fall/toc.html and go to source to view that part.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting HTML code from servlets ?