O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending Email

The shopping cart example we have reviewed allowed the user to send an email to the Webmaster for the site. This provides an opportunity to examine the use of JavaMail in a Web application. The JSP page shown next demonstrates how this is done.

The MailService (examples.javamail.MailService) class provides a simplified access to the JavaMail API. We also access the user bean from the session to allow us to fill in the values for some of the fields in the form.

This page is an HTML form and contains various input tags to gather information about the email. The from email address is provided on one of these lines. We use the value attribute for the input tag to set the value to that of the email address of the reader.

The email.jsp ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required