Implementing Email Delivery Functionality
Once we have set up a JavaMail session as described in the previous section, implementing the email delivery functionality is fairly simple. The process is illustrated in the following code example package net.ensode.glassfishbook import javax.annotation.Resource import javax.mail.Message import javax.mail.MessagingException import javax.mail.Session import javax.mail.Transport import javax.mail.internet.AddressException import javax.mail.internet.InternetAddress import...
Core JSTL Tag Library
Core JSTL tags perform tasks like writing output to the browser, conditional display of segments in a page, and iterating through collections. Much of what the core JSTL tags do can be accomplished with scriptlets however, the page is much easier to read and therefore more maintainable if core JSTL tags are used, instead of scriptlets. The following example shows a JSP using some of the most common JSTL core tags lt page language java contentType text html charset UTF-8 pageEncoding UTF-8 gt lt...
GlassFish Configuration
Before we can start sending emails from our Java EE applications, we need to do some initial GlassFish configuration. A new JavaMail session needs to be added by logging into the GlassFish web console, expanding the Resources node in the tree at the left-hand side of the page, then clicking on the JavaMail Sessions node. Sun Java System Application Server 9.1 Admin Console - Mozilla File Edit View History Bookmarks Tools Help User admin Domain domainl Server bcalhost Sun Java System Application...
Writing a Facelets Application
Other than the additional necessary configuration, the only difference between a JSF application using Facelets and one using JSPs is the view technology used. Facelets applications typically use XHTML pages for the view. In this section, we will develop a fictitious pizza ordering system. The markup for the data entry page looks like this lt xml version 1.0 encoding UTF-8 gt lt DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN lt html xmlns http www.w3.org 199 9 xhtml lt head gt lt meta...
Downloading Ajaxjsf
Ajax4jsf can be downloaded by pointing the browser to http labs.jboss.com jbossajax4jsf downloads and clicking on the Download link corresponding to the latest version. jboss.org community driven - Mozilla Firefox Elle Edit View History Bookmarks Tools Help I j I j jboss-ajax4jsf-1.1.1 -bi n .zip latest jbo5s-ajax4jsf-l.l,l-bin.tar.gz latest JBoss AJax4jsf 1.1.1 Binary tar.gz JBoss A ax4 sf 1.1.1 Source tar.gz JBoss AJax4 sf 1.1.0 Source tar.gz JBoss A ax4 sf 1.0.7 Source tar.gz In order to...
JSTL Functions
JSTL contains a number of functions that take Unified Expression Language expressions as parameters. All JSTL functions except one are used exclusively for String manipulation. The exception is the fn length function, which can take a String, Collection, or array as a parameter it returns the length of the String, the size of the Collection, or the length of the array, depending on what parameter is passed to it. The following JSP illustrates the use of JSTL functions. lt page language java...
Configuring Our JSF Application for Ajaxjsf
Before we can use Ajax4jsf to AJAX enable our JSF application, we need to configure it by modifying its web.xml deployment descriptor. lt web-app version 2.5 xmlns xsi http www.w3.org 2 0 01 XMLSchema-instance javaee lt context-param gt lt listener gt lt listener-class gt lt listener gt lt servlet gt lt servlet-name gt Faces Servlet lt servlet-name gt servlet-class gt lt servlet gt lt servlet-mapping gt lt servlet-name gt Faces Servlet lt servlet-name gt lt servlet-mapping gt lt filter gt lt...
The CustomerDB Database
Examples in this chapter will use a database called customerdb. This database contains tables to track customer and order information for a fictitious store. The database uses JavaDB for its RDBMS, as it comes bundled with GlassFish. A script is included with this book s code download to create this database and pre-populate some of its tables. Instructions on how to execute the script and add a connection pool and datasource to access it are included in the download as well. The schema for the...




