Visit Gopalan Suresh Raj's Web Cornucopia...

Developing the E-Mail Contents Session Object Bean
Gopalan Suresh Raj

Note
To work with any of these samples, you will need the following:
.........................................JDK 1.1.7 or higher

To work with the Servlets and JSP, you will need
.........................................
JSWDK 1.0.1 or higher

To work with the Java Mail API, you will need
.........................................
JavaMail 1.1.3 or higher
.........................................
Java Activation Framework 1.0.1 or higher
.........................................
POP3 Provider 1.1.1 or higher

1. Develop the EmailContents Bean that's used to make up your Session Object

Develop the EmailContents Bean that both the Servlet and the EmailContents.jsp use to read the session value. Compile the file and create the class file.

The JSP Model 2 Architecture
(Model-View-Controller Based)

Figure shows what we are trying to ultimately accomplish in these pages here.

EmailHandler\EmailContents.java
package EmailHandler;

import java.util.*;

public class EmailContents implements java.io.Serializable { 
  private String m_from;
  private Vector m_to = new Vector();
  private Vector m_cc = new Vector();
  private Vector m_bcc = new Vector();
  private String m_subject;
  private String m_body;
  
  public EmailContents (String from, Vector to, Vector cc,
                        Vector bcc, String subject, String body) {
   m_from = from;
   m_to = (Vector)to.clone ();
   m_cc = (Vector)cc.clone ();
   m_bcc = (Vector)bcc.clone ();
   m_subject = subject;
   m_body = body;
  }
  
  public String getFrom () { return m_from; }
  public Vector getTo () { return m_to; }
  public Vector getCc () { return m_cc; }
  public Vector getBcc () { return m_bcc; }
  public String getSubject () { return m_subject; }
  public String getBody () { return m_body; }
  
  public void setFrom (String from) { m_from = from; }
  public void setTo (Vector to) { m_to = (Vector)to.clone (); }
  public void setCc (Vector cc) { m_cc = (Vector)cc.clone (); }
  public void setBcc (Vector bcc) { m_bcc = (Vector)bcc.clone (); }
  public void setSubject (String subject) { m_subject = subject; }
  public void setBody (String body) { m_body = body; }
  
}

2. Create a Directory called "EmailHandler" on the "jswdk-1.0.1\examples\WEB-INF\jsp\beans\" directory and Copy this JSP page there.

click here to go to
My JSP/Servlets HomePage...

About the Author...
Gopalan Suresh Raj is a Software Architect, Developer and an active Author. He is contributing author to a couple of books "Enterprise Java Computing-Applications and Architecture" and "The Awesome Power of JavaBeans". His expertise spans enterprise component architectures and distributed object computing. Visit him at his Web Cornucopia© site (http://www.execpc.com/~gopalan) or mail him at gopalan@execpc.com.

Go to the Component Engineering Cornucopia page

This site was developed and is maintained by Gopalan Suresh Raj

This page has been visited times since September 21,1998.

Last Updated : Dec 19, '98

If you have any questions, comments, or problems regarding this site, please write to me I would love to hear from you.


Copyright (c) 1997-2000, Gopalan Suresh Raj - All rights reserved. Terms of use.

All products and companies mentioned at this site are trademarks of their respective owners.