Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

SimpleMail Apache Error

Thread view: 
coolgirl - 25 Mar 2006 18:10 GMT
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)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.