Hi,
a little hint to refine the method Wayan proposed
deploy your static HTML as a resource to your Web-App (place it into
war file) and then use
public java.io.InputStream getResourceAsStream(java.lang.String path)
of ServletContext object to get InputStream.
For the mapping of resources,i.e. which path argument to use, please
refer to the servlet spec found at java.sun.com
sincerely
peter huber
----- Original Message -----
From: I Wayan Saryada <[EMAIL PROTECTED]>
Date: Friday, November 9, 2001 9:28 am
Subject: Re: how to include static file into servlet?
> You can do something like this on your servlet:
>
> PrintWriter out = response.getWriter();
> BufferedReader buf = new BufferedReader(new
> FileReader(request.getContextPath() + "/" + fileName));
> String htmlBuf = "";
> while ((htmlBuf = buf.readLine())!=null) {
> out.println(htmlBuf);
> }
> out.flush();
> out.close();
> buf.close();
>
>
> Regards,
> -Wayan-
>
> -----Original Message-----
> From: Alex Kachanov [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 09, 2001 3:00 PM
> To: [EMAIL PROTECTED]
> Subject: how to include static file into servlet?
>
>
> instead of typing all those out.println()
> I just want to include into servlet
> a static file which contains a huge peice of html code
>
> how can I do this?
>
> with best wishes
> Alexander Kachanov
>
>
________________________________________________________________________
___
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
> the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http:
> Resources: http://java.sun.com/products/servlet/external-
> resources.htmlLISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
________________________________________________________________________
___
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
> the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http:
> Resources: http://java.sun.com/products/servlet/external-
> resources.htmlLISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
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