Hi,
Im trying to send an email through a .jsp page
by pulling all the input data from a previous html page
on and apache tomcat server, however I keep getting 3 errors:
"org.apache.jasper.JasperException: Unable to compile class for JSP"
which relate to the import="org.apache.commons.mail.SimpleEmail"
its not pulling in the class or maybe its something I overlooked,
Another set of eyes would be very helpful
Regards
<html>
<%@page import="java.util.*"%>
<!--<%//@page import="org.apache.commons.mail.SimpleEmail"%>-->
<%@page import="org.apache.commons.lang.StringUtils"%>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<body bgcolor="white">
<%
String aname, bname, cname, dname, ename, fname, Nname, Gname;
aname.equals(request.getParameter("Person"));
if (aname!="")
Nname.equals("Name :" + aname + "<br />");
bname.equals(request.getParameter("Email"));
if (bname!="")
Nname.equals(Nname + "Email :" + bname + "<br />");
cname.equals(request.getParameter("Phone"));
if (cname!="")
Nname.equals(Nname + "Phone :" + cname + "<br />");
dname.equals(request.getParameter("Area"));
if (dname!="")
Nname.equals(Nname +" Area :" + dname + "<br />");
ename.equals(request.getParameter("Comments"));
if (ename!="")
Nname.equals(Nname + "Comments :" + ename + "<br />");
//'Gname=Request.Form("webmaster")
//'(Gname)
//'response.Write(Nname)
//'response.Write(fname)
SimpleEmail email = new SimpleEmail();
email.setHostName("HostName");
email.addTo("webmaster", "You");
email.setFrom("Email", "Me");
email.setSubject("Test message");
email.setMsg("Nname");
email.send();
//Set myMail=CreateObject("CDO.Message")
//myMail.Subject="Contact from omni-sound"
//myMail.From=Request.Form("Email")
//myMail.To=Request.Form("webmaster")
//myMail.HTMLBody=Nname
//myMail.Send
//'response.Write("<br />Sent<br />")
fname=request.getParameter("next_url");
if( fname!="" )
response.sendRedirect(fname);//'response.Write
%>
</h1>
</html>
PerfectDayToChaseTornados - 25 Mar 2006 21:37 GMT
| Hi,
|
[quoted text clipped - 10 lines]
|
| Regards
Hi,
Have you got the class (or jar containing the class) in your classpath?
It's pretty ugly putting that kind of functionality in a JSP anyway & hard
to test/refactor/re-use the code. You should really move it to another class
& call it via a Servlet or Command Object in an MVC framework (e.g. Spring
or Struts)

Signature
-P
"Programs that are hard to read are hard to modify.
Programs that have duplicated logic are hard to modify.
Programs with complex conditional logic are hard to modify"
( Kent Beck)