aspose file tools*
The moose likes JSP and the fly likes Cannot Call My class file from JSP. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

Cannot Call My class file from JSP.

bat ken
Greenhorn

Joined: Dec 28, 2005
Posts: 24
Hi,

I having an error :
500 Servlet Exception
/mrs/authorise/mr_newreq.jsp:78: jsp:useBean can't find class `common.SendMail'

In my JSP (new_req.jsp)
-----------------------
<jsp:useBean id = "db" class="bgoc.dbConn.Conn" scope="request" />
<% Connection conn = db.getConnection(); %>

<jsp:useBean id = "passend" class="common.sendMail" scope="request"/>

My sendMail.class
-----------------
package common;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;


public class sendMail{
public void sending(String SMTPServer,
String Sender,
String Recipient,
String CcRecipient,
String BccRecipient,
String Subject,
String Body,
String Attachments){
// Get system properties

Properties props = System.getProperties();

// Setup mail server
props.put("mail.smtp.host", SMTPServer);

// Get session
Session session = Session.getDefaultInstance(props, null);

// Define message
MimeMessage message = new MimeMessage(session);
try
{
message.setFrom(new InternetAddress(Sender));
{
InternetAddress[] TheAddresses = InternetAddress.parse(Recipient);
message.addRecipients(Message.RecipientType.TO,TheAddresses);
}
if (null != CcRecipient) {
InternetAddress[] TheAddresses = InternetAddress.parse(CcRecipient);

message.addRecipients(Message.RecipientType.CC,TheAddresses);
}
if (null != BccRecipient) {
InternetAddress[] TheAddresses = InternetAddress.parse(BccRecipient);

message.addRecipients(Message.RecipientType.BCC,TheAddresses);
}


message.setSubject(Subject);
// Create the Multipart to be added the parts to
Multipart mp = new MimeMultipart();

// Create and fill the first message part
{
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText(Body);

// Attach the part to the multipart;
mp.addBodyPart(mbp);
}

// Attach the files to the message
if (null != Attachments) {
int StartIndex = 0, PosIndex = 0;
while (-1 != (PosIndex = Attachments.indexOf("///",StartIndex))) {
// Create and fill other message parts;
MimeBodyPart mbp = new MimeBodyPart();
FileDataSource fds =
new FileDataSource(Attachments.substring(StartIndex,PosIndex));
mbp.setDataHandler(new DataHandler(fds));
mbp.setFileName(fds.getName());
mp.addBodyPart(mbp);
PosIndex += 3;
StartIndex = PosIndex;
}
// Last, or only, attachment file;
if (StartIndex < Attachments.length()) {
MimeBodyPart mbp = new MimeBodyPart();
FileDataSource fds = new FileDataSource(Attachments.substring(StartIndex));
mbp.setDataHandler(new DataHandler(fds));
mbp.setFileName(fds.getName());
mp.addBodyPart(mbp);
}
}

// Add the Multipart to the message
message.setContent(mp);

// Set the Date: header
message.setSentDate(new Date());

// Send the message;
Transport.send(message);
}
catch (MessagingException e)
{
System.err.println("Caught Exception: "
+ e.getMessage());
}}}

------------------------------------------
My class' location is
C:\resin-2.1.6\doc\WEB-INF\classes\common
------------------------------------------

Why I cant call my bean file?Please assist me....

Thank You.

regards,
batken
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

Please do not post the same question more than once.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot Call My class file from JSP.
 
Similar Threads
FileNotFound Exception
send attachment Using JSP with JavaMail
Attach a file using java api
email not reaching recipient
problem with my jsp page