A Practical Guide for Integrating EJB and Struts : Page 6
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.
by Stephen Lum
May 19, 2004
Page 6 of 7
Package for Deployment
Now you're ready to package your application and deploy it to the JBoss application server. You can package your application in many ways, but this tutorial uses the packaging capability within Eclipse.
Create the EJB.jar file
Right click on your project StrutsEJBTutorial in the package explorer, click properties, and then click Packaging Configurations.
Right click in the large white space on the right, click Add Archive, and name the file StockEJB.jar. Click OK (see Figure 16).
Right click on StockEJB.jar and choose Add Folder. Click Project Folder, select WEB-INF/classes, and then click OK. In the Includes text box type: lum/stock/ejb/bean/*.class,lum/stock/ejb/interfaces/*.class,lum/staticvalues/*.class,lum/stock/*.class, and click OK (see Figure 17).
Figure 17: Dialog Box for Adding the WEB-INF/classes Folder
Right click on StockEJB.jar and choose Add File. Click Project Folder, and select ejb-jar.xml under the /META-INF directory. In the prefix box, type: META-INF (see Figure 18).
Figure 18: Dialog Box for Adding the ejb-jar.xml File
Right click on StockEJB.jar and choose Add File. Click Project Folder, and select jboss.xml under the /META-INF directory. In the prefix box, type: META-INF. Click OK.
Create the EJB-client.jar File
Right click in the large white space on the right, click Add Archive, and name the file StockEJB-client.jar. Click OK.
Right click on StockEJB-client.jar and choose Add Folder. Click Project Folder, select WEB-INF/classes, and then click OK. In the Includes text box, type: lum/stock/ejb/interfaces/*.class, and click OK.
Right click on StockEJB-client.jar and choose Add File. Click Project Folder, and select ejb-jar.xml under the /META-INF directory. In the prefix box, type: META-INF. Click OK.
Right click on StockEJB-client.jar and choose Add File. Click Project Folder, and select jboss.xml under the /META-INF directory. In the prefix box, type: META-INF. Click OK (see Figure 19).
Right click in the large white space on the right, click Add Archive, and name the file StockWeb.war. Click OK.
Right click on StockWeb.war and choose Add Folder. Click Project Folder, select WEB-INF, and then click OK. In the Includes text box, type: *.xml,*.tld, and in Prefix, type: WEB-INF. Click OK (see Figure 20).
Right click on StockWeb.war and choose Add File. Click Project Folder, and select index.jsp. Click OK.
Right click on StockWeb.war and choose Add File. Click Project Folder, and select application.properties under the /WEB-INF/classes/resources/ directory. In the prefix box, type: WEB-INF/classes/resources, and click OK (see Figure 21).
Figure 21: Structure After Adding application.properties
Right click on StockWeb.war and choose Add Folder. Click Project Folder, select pages, and then click OK. In the Prefix, type: pages, and click OK.
Right click on StockWeb.war and choose Add Folder. Click Project Folder, select WEB-INF/classes, and then click OK. In the Includes text box, type: lum/staticvalues/*.class,lum/stock/*.class,lum/stock/action/*.class,lum/stock/facade/*.class, and in the Prefix, type: WEB-INF/classes, and click OK.
Right click on StockWeb.war and choose Add File. Click Project Folder, and type: /StockEJB-client.jar after your project name. Here, you're telling Eclipse to package your EJB-client.jar in the .war file, even though you have not created it yet. In the prefix box, type: WEB-INF/lib and click OK (see Figure 22).
Right click on StockWeb.war and choose Add Folder. Click Project Folder, select WEB-INF/lib, and then click OK. In the Prefix, type: WEB-INF/lib, and click OK (see Figure 23).
Right click in the large white space on the right, click Add Archive, and name the file Stock.ear. Click OK.
Right click on Stock.ear and choose Add File. Click Project Folder, and select application.xml under the /META-INF directory. In the Prefix, type: META-INF, and click OK.
Right click on Stock.ear and choose Add File. Click Project Folder, and type: /StockEJB.jar after your project name. Again, you are telling Eclipse to package a file that you have not yet created. Click OK (see Figure 24).
Right click on Stock.ear and choose Add File. Click Project Folder, and type: /StockWeb.war after your project name. Again, you are telling Eclipse to package a file that you have not yet created. Click OK (see Figure 25).