Hi:
I can successfully get any HTML message from any http web site and then email
the
output using the Java codes .
For example, if I want to email the the html from web site
"http://www.yahoo.com/", I
just set URL like
url= new URL("http://www.yahoo.com");
My Java code is something like that:
**************************
package emailtools
import java.io.*;
import java.net.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class EmailBean{
.......
.......
private Session session;
private MimeMessage msg;
private URL url;
private BufferedReader in;
public EmailBean() throws MalformedURLException, IOException {
url= new URL("http://www.yahoo.com");
in= new BufferedReader(new InputStreamReader(url.openStream()));
.....
.....
private boolean messageHandle(){
Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
session = Session.getDefaultInstance(props, null);
......
......
}
public void collectHtml(BufferedReader in, Message msg)
throws MessagingException, IOException {
String line;
StringBuffer sb = new StringBuffer();
..........
while ((line = in.readLine()) != null) {
sb.append(line);
...............
}
}
*****************************
I try to use the same code to run a JSP and try to use it's output as the content
of an
email message. I just rewrite the
url= new URL("http://127.0.0.1:8080/examples/jsp/mailtools/test.jsp").
in the bean.
But when I turn on the server, it seems the server can not find the the site and
just endlessly looking for it.
I guess I should use "HttpURLConnection" to connect to JSP as browser.
But I don't know where I should add it: in bean, or in JSP?
Because I use "forward" to send the result to another JSP. The first and second
JSP have same URL. How I get the send JSP?
Thanks.
===========================================================================
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