Ken,
The error is basically complaining that it has no idea what the method sendEmail()
is. From your code, I can't tell either; where is the JSP page supposed to find
this method? i.e. What object has this method? The JavaMail API has some send()
methods, but they usually take Message objects as parameters, not the list of
Strings you're trying to use (in other words, you'll need to create a Message
object first).
-- Tom "yes I'm posting, even though I know I'll get a flood of ^&%#*& bounced
mail"
Ken Gerdes wrote:
> Hi,
>
> I'm having trouble with my JSP code. It is an HTML form handler, that is
> supposed to get the values from an HTML form, and send them using the
> Javamail API. Here is my code:
>
> <html>
> <head>
> <title>JSP JavaMail Example</title>
> </head>
>
> <body>
>
> <%@ language="java"
> import="java.util.*,javax.mail.*,javax.mail.internet.*,javax.activation.*,ja
> vax.servlet.http.*" method="d
> oPost" %>
>
> <%
>
> String host = "10.0.0.123";
> String to = request.getParameter("to");
> String from = request.getParameter("from");
> String subject = request.getParameter("subject");
> String messageText = request.getParameter("body");
> sendEmail(host, to, from, subject, messageText);
>
> %>
>
> <p>Mail sent successfully</p>
> </body>
> </html>
>
> And when I run it, these are the compilation errors I get:
>
> /opt/IBMWebAS/servlets/pagecompile/_USC/_ken/_mailexample2_xjsp.java:58:
> warning: function getParameter(java.lang.String) in interface
> javax.servlet.ServletRequest has been deprecated
> String to = request.getParameter("to");
> ^
> /opt/IBMWebAS/servlets/pagecompile/_USC/_ken/_mailexample2_xjsp.java:59:
> warning: function getParameter(java.lang.String) in interface
> javax.servlet.ServletRequest has been deprecated
> String from = request.getParameter("from");
> ^
> /opt/IBMWebAS/servlets/pagecompile/_USC/_ken/_mailexample2_xjsp.java:60:
> warning: function getParameter(java.lang.String) in interface
> javax.servlet.ServletRequest has been deprecated
> String subject = request.getParameter("subject");
> ^
> /opt/IBMWebAS/servlets/pagecompile/_USC/_ken/_mailexample2_xjsp.java:61:
> warning: function getParameter(java.lang.String) in interface
> javax.servlet.ServletRequest has been deprecated
> String messageText = request.getParameter("body");
> ^
> /opt/IBMWebAS/servlets/pagecompile/_USC/_ken/_mailexample2_xjsp.java:62:
> function sendEmail(java.lang.String, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String) not found in class
> pagecompile._USC._ken._mailexample2_xjsp
> sendEmail(host, to, from, subject, messageText);
> ^
> 1 error
> 4 warnings
>
> Anybody know why this is happening?
>
> Thanks, Ken
>
> ===========================================================================
> 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
--
__________________________________________________________________________
The statements and opinions expressed here are my own
and do not necessarily represent those of Oracle Corporation
===========================================================================
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