Simple Example: Model 2 Hello World

The Model 2 Hello World example is a simple app used to demonstrate Ant and some of the basic concepts of the other tools. You can download the complete code for this example at Model 2 Hello World involves building, deploying, and testing an applet, a servlet, a few JavaServer Pages (JSPs), an app, several Java classes, and two Enterprise JavaBeans (EJBs). The applet is delivered to a browser using the plugin tag from a JSP. Then, the applet talks to a servlet. The servlet communicates with the EJB server, which maps a JavaBean into the session and redirects to a second JSP. The second JSP makes a call on the JavaBean, which calls an enterprise bean, which is a session bean. The session bean in turn calls an entity bean. Here is a graphical representation:

Java Click To expand

All of these components must be packaged and configured so they can speak to one another. In this example, we create a JAR file, an EJB JAR file, a WAR file, and an EAR file, each with the appropriate manifest and deployment descriptors using Ant.