Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting HTML code from servlets ?

 
Zeusman Rana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Zeusman Rana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops sorry the url is http://www-scf.usc.edu/~csci571
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Irudaya Joseph
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic