RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


A Practical Guide for Integrating EJB and Struts : Page 7

EJB and the Struts framework each have received plenty of coverage individually, but what about leveraging EJB and Struts together? This tutorial lays out a complete step-by-step guide to integrating these two technologies.

Deploy the Application
You are almost there!
  1. Click the Run menu item, and click Debug. Click JBoss 3.2.x and then click New in the bottom left-hand corner. Under Name, type: JBoss 3.2.3. Under Home Directory, navigate to the location where you unzipped JBoss (see Figure 26).

    Figure 26: A Debug Session for JBoss
  2. Click Apply, and then Debug. This will start the JBoss server, which you can see in the Console window.
  3. In the Package Explorer window, right click Stock.ear, and go to Deployment -> Deploy To... . In the popup box, choose (default) and click OK. You will now see a green arrow on the Stock.ear file (see Figure 27).

    Figure 27: Deploy the .ear file to Default Directory of JBoss Server
  4. Open a browser and type in http://localhost:8080/stock/pages/stockquery.jsp.

At this point, you can see the application return its data, and you can set breakpoints in the application, including within the StockBean EJB.

Leverage Struts and EJB
You can integrate both Struts and EJB in various ways, using various tools. This tutorial has illustrated just one of the methods. Being able to integrate the two will give you a good foundation for the popular Struts architecture. Perhaps next you'd like to try your luck at building an entity bean within the framework.

If you still have problems with installation, a number of good online resources can walk you through it, including:

  1. The Power of Three – Eclipse, Tomcat, and Struts by Keld H. Hansen
  2. JBoss-IDE 1.2.2 Tutorial Guide

Stephen Lum is a senior developer for Barclays Capital in London. He is a Sun-certified Java programmer and Oracle-certified developer who has been programming in Java for over six years.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date