I use somthing like:
java.net.URL url = new java.net.URL ("http://myserver/myPage.jsp");
java.io.InputStreamReader reader = new java.io.InputStreamReader
(url.openStream());
char[] buff = new char[100];
int c = reader.read(buff);
StringBuffer str = new StringBuffer ();
while (c >= 0) {
String str = new String (buff, 0, c);
str.append(str);
c = reader.read(buff);
}
afterwards str contain the result of the JSP. The problem with that
technique is that JSP engines usually report errors in JSP using HTML
output. If you direct that code to a problematic JSP you'll have the error
message as the content of str, and i couldn't find any way to go around it.
What i do is that each JSP inherits from a baseclass of my own, and that
class flags the page as errored in a general fault repository, i use that
repository to determines whther i called an active JSP or not.
lee
Lee Elenbaas
ViryaNet
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Xunming Liu
Sent: Tuesday, May 02, 2000 8:50 PM
To: [EMAIL PROTECTED]
Subject: Re: Can I get static HTML page from JSP?
Hi:
I wanna do the same thing as you. But I don't know how to run a JSP and send
it's
output using email?
Would you please explain it in detailed example?
Thanks a lot.
Xunming
Lee Elenbaas wrote:
> We do a similar thing, we run a JSP and use it's output as the content of
an
> email message.
> We do it by connecting to the JSP as a browser (using HttpURLConnection)
and
> retrieving the content of the URL.
>
> lee
> ViryaNet
> [EMAIL PROTECTED]
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets