| Sun Java System Application Server |
The HelloWorld Stateless Simple EJB application is a basic example of a J2EE application that uses servlets, an EJB, and Java Server Pages. The EJB is a stateless session bean.
The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:
install_dir is the directory where Application Server
is installed.
app_dir is the application base directory: install_dir/samples/ejb/stateless/apps/simple.
stateless-simple.ear.
Follow this general procedure:
build.xml, is in the app_dir
directory, specifically, install_dir/samples/ejb/stateless/apps/simple.
install_dir/samples/ejb/stateless/apps/simple/stateless-simple.ear.
http://hostname:port/helloworld.
When you load the application URL shown above, you will see the main page that prompts you to enter your name. Enter a name and press the Process button. Pressing a button invokes a servlet. The servlet calls a stateless session bean, which returns a greeting to the servlet based upon the current system time. Then the servlet dispatches a JSP page to deliver the greeting to the browser that depends on the time of day ("Good morning," "Good afternoon," and so on).
This application is an example of a Model/View/Controller (MVC) design pattern, as illustrated in the figure below. Each part of an MVC design has an independent role:
As depicted in this diagram, pressing the "Process" button in the main page invokes a servlet, the application "controller." The servlet calls a stateless session bean (the "model") to determine a greeting based upon the current system time. The servlet dispatches a JSP page (the "view") to deliver the greeting back to the browser.
Copyright © 2006 Sun Microsystems, Inc. All rights reserved.