"Hartono (Telebot)" wrote:
> Hi ... I want to open an HTML file using a servlet, so I didn't have
> to code the HTML in my servlet !Currently I'm using the path to my C:
> drive like the following lines !! FileObject endObj = new
> FileObject("C:\\servlet\\PostingJob\\end.html"); But when I changed
> the referenced like : FileObject endObj = new
> FileObject("http://localhost:8000/servlet/PostingJob/main.html");The
> servlet cannot open the file and give me an exception ??? any body
> know how to do this ?? any help would very appreciated
> !! regards,Hartono sutirman
You are getting an exception because a URL that starts with "http:" is
not a valid filename for your operating system. Presumably, your
FileObject class uses java.io.FileInputStream or something like that,
which requires you to specify a valid filename or pathname.
If you want to load the contents of an HTML page (or any other type of
file) retrieved from a web server, you want to use a URLConnection
object instead. There is some nice example code for this in the
Networking Trail of the Java Language Tutorial
(http://java.sun.com/docs/books/tutorial).
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html