Previous  Table of Contents  Next  

  J2EE Tools - Lightweight IDE for J2EE Version 1.4  
     
 

GETTING STARTED

Build, Deploy and Run Book Store 1 Web Application

This page describes how to build, deploy and run the Book Store 1 web application in the J2EE Tutorial.
  1. Browse Book Store 1 Web Application in J2EE Tutorial:

    1. Click Help | J2EE Tutorial in the J2EE Tools window.
    2. Wait until the J2EE Tutorial appears in the browser window.
    3. Scroll to Chapter 11: Java Servlet Technology then click The Example Servlets.
    4. When done browsing, click X in the top right corner of the browser window.
  2. Build Book Store Java Archive File:

    1. Click the Application tab in the J2EE Tools window.
    2. Click the Project Directory box in the Application tab then click web in the popup list.
    3. Click the Application Directory box then click bookstore.
    4. Click the Build File box then click build.xml (default).
    5. Click the Build Target box then click build (default).
    6. Click Tools | Build.
    7. Wait until Build Successful appears in the Build Target window.
    8. Click X in the top right corner of the Build Target window.
    9. Click the Build Target box then click package-bookstore.
    10. Click Tools | Build.
    11. Wait until Build Successful appears in the Build Target window.
    12. Click X in the top right corner of the Build Target window.
  3. Start Database Server:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Tools | Database Server | Start in the J2EE Tools window.
      2. Wait until Server started appears in the Database Server window.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database Server | Start in the J2EE Tools window.
      2. Wait until Command start-database executed successfully appears in the Start Database Server window.
      3. Click X in the top right corner of the Start Database Server window.
  4. Create Book Store Database:

    1. Click the Build Target box in the J2EE Tools window then click create-db_common in the popup list.
    2. Click Tools | Build.
    3. Wait until Build Successful appears in the Build Target window.
    4. Click X in the top right corner of the Build Target window.
  5. Display Books Database Table:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Tools | Database | Console in the J2EE Tools window.
      2. Wait until the Connect to Database dialog appears.
      3. Click the URL field in the Connect to Database dialog then type jdbc:pointbase:server://localhost:9092/sun-appserv-samples in the field.
      4. Click the Password field then type PBPUBLIC.
      5. Click OK.
      6. Wait until the PointBase Console window appears.
      7. Click the Enter SQL Commands area in the PointBase Console window then type select * from books; in the area.
      8. Click Execute above the Enter SQL Commands area.
      9. Verify that the inventory field to right of the title field containing Duke: A Biography of the Java Evangelist contains 20.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database | Command Line Interface in the J2EE Tools window.
      2. Wait until the Database Command Line Interface window appears.
      3. Click the Enter field in the Database Command Line Interface window then type select * from books; and press the Enter key.
      4. Verify that the inventory field to right of the title field containing Duke: A Biography of the Java Evangelist contains 20.
  6. Start Application Server:

    1. Click Tools | Application Server | Start in the J2EE Tools window.
    2. Wait until Application server startup complete appears in the Start Application Server window.
    3. If the domain window appears, click _ (minimize) in the top right corner of the domain window.
  7. Create Book Store JDBC Resource on Application Server:

    1. Click the Build Target box in the J2EE Tools window then click create-jdbc-resource_common in the popup list.
    2. Click Tools | Build.
    3. Wait until Build Successful appears in the Build Target window.
    4. Click X in the top right corner of the Build Target window.
  8. Build Book Store 1 Web Application:

    1. Click the Application Directory box in the J2EE Tools window then click bookstore1 in the popup list.
    2. Click the Build File box then click build.xml (default).
    3. Click the Build Target box then click build (default).
    4. Click Tools | Build.
    5. Wait until Build Successful appears in the Build Target window.
    6. Click X in the top right corner of the Build Target window.
  9. Create Book Store 1 Web Application Web Archive File:

    1. Click Tools | Deployment | Console in the J2EE Tools window.
    2. Wait until the Deployment Tool window appears.
    3. Click File | New | Web Component in the Deployment Tool window.
    4. Click Next in the New Web Application Wizard - Introduction dialog.
    5. Click Create New Stand-Alone WAR Module in the New Web Application Wizard - WAR File dialog.
    6. Click Browse to the right of the WAR Location field.
    7. Click Up One Level in the Create Module File dialog until Local Disk (C:) appears in the Look In box.
    8. Double click the fieldbird directory in the Look In area.
    9. Double click the j2eetools directory in the Look In area.
    10. Double click the j2ee directory in the Look In area.
    11. Double click the projects directory in the j2ee directory.
    12. Double click the web directory in the projects directory.
    13. Double click the bookstore1 directory in the web directory.
    14. Click the File Name field then type bookstore1.war.
    15. Click Create Module File.
    16. Verify that the WAR Location field in the New Web Application Wizard - WAR File dialog contains C:\fieldbird\j2eetools\j2ee\projects\web\bookstore1\bookstore1.war.
    17. Click the WAR Name field then type bookstore1.
    18. Click the Context Root field then type /bookstore1.
    19. Click Edit Contents.
    20. Verify that the Starting Directory box in the Edit Contents dialog contains C:\fieldbird\j2eetools\j2ee\projects\web\bookstore1.
    21. Double click the build directory in the Available Files area.
    22. Click the database directory in the build directory then click Add.
    23. Click the filters directory in the build directory then click Add.
    24. Click the listeners directory in the build directory then click Add.
    25. Click the servlets directory in the build directory then click Add.
    26. Click the util directory in the build directory then click Add.
    27. Click the duke.books.gif file in the build directory then click Add.
    28. Click the errorpage.html file in the build directory then click Add.
    29. Click Up One Level until C:\fieldbird\j2eetools\j2ee\projects\web appears in the Starting Directory box.
    30. Double click C:\fieldbird\j2eetools\j2ee\projects\web in the Available Files area.
    31. Double click the bookstore directory in the web directory.
    32. Double click the dist directory in the bookstore directory.
    33. Click the bookstore.jar file in the dist directory then click Add.
    34. Click OK.
    35. Click Next in New Web Application Wizard - WAR File dialog.
    36. Click Servlet in the New Web Application Wizard - Choose Component Type dialog.
    37. Click Next.
    38. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.BannerServlet in the popup list.
    39. Click Finish.
  10. Add Other Book Store 1 Web Application Servlets to Web Archive File:

    1. Click File | New | Web Component in the Deployment Tool window.
    2. Click Next in the New Web Application Wizard - Introduction dialog.
    3. Click Add to Existing WAR Module in the New Web Application Wizard - WAR File dialog.
    4. Click the Add to Existing WAR Module box then click bookstore1.
    5. Click Next.
    6. Click Servlet in the New Web Application Wizard - Choose Component Type dialog.
    7. Click Next.
    8. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.BookDetailsServlet in the popup list.
    9. Click Finish.
    10. Click File | New | Web Component in the Deployment Tool window.
    11. Click Next in the New Web Application Wizard - Introduction dialog.
    12. Click Next in the New Web Application Wizard - WAR File dialog.
    13. Click Next in the New Web Application Wizard - Choose Component Type dialog.
    14. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.BookStoreServlet in the popup list.
    15. Click Finish.
    16. Click File | New | Web Component in the Deployment Tool window.
    17. Click Next in the New Web Application Wizard - Introduction dialog.
    18. Click Next in the New Web Application Wizard - WAR File dialog.
    19. Click Next in the New Web Application Wizard - Choose Component Type dialog.
    20. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.CashierServlet in the popup list.
    21. Click Finish.
    22. Click File | New | Web Component in the Deployment Tool window.
    23. Click Next in the New Web Application Wizard - Introduction dialog.
    24. Click Next in the New Web Application Wizard - WAR File dialog.
    25. Click Next in the New Web Application Wizard - Choose Component Type dialog.
    26. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.CatalogServlet in the popup list.
    27. Click Finish.
    28. Click File | New | Web Component in the Deployment Tool window.
    29. Click Next in the New Web Application Wizard - Introduction dialog.
    30. Click Next in the New Web Application Wizard - WAR File dialog.
    31. Click Next in the New Web Application Wizard - Choose Component Type dialog.
    32. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.ReceiptServlet in the popup list.
    33. Click Finish.
    34. Click File | New | Web Component in the Deployment Tool window.
    35. Click Next in the New Web Application Wizard - Introduction dialog.
    36. Click Next in the New Web Application Wizard - WAR File dialog.
    37. Click Next in the New Web Application Wizard - Choose Component Type dialog.
    38. Click the Servlet Class box in the New Web Application Wizard - Component General Properties dialog then click servlets.ShowCartServlet in the popup list.
    39. Click Finish.
  11. Add Book Store 1 Web Application Servlet Aliases to Web Archive File:

    1. Click BannerServlet under bookstore1 on the left side of the Deployment Tool window.
    2. Click the Aliases tab on the right side of the Deployment Tool window.
    3. Click Add in the Aliases tab.
    4. Click the field under Aliases then type /banner and press the Enter key.
    5. Click BookDetailsServlet under bookstore1 on the left side of the Deployment Tool window.
    6. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    7. Click the field under Aliases then type /bookdetails and press the Enter key.
    8. Click BookstoreServlet under bookstore1 on the left side of the Deployment Tool window.
    9. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    10. Click the field under Aliases then type /bookstore and press the Enter key.
    11. Click CashierServlet under bookstore1 on the left side of the Deployment Tool window.
    12. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    13. Click the field under Aliases then type /bookcashier and press the Enter key.
    14. Click CatalogServlet under bookstore1 on the left side of the Deployment Tool window.
    15. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    16. Click the field under Aliases then type /bookcatalog and press the Enter key.
    17. Click ReceiptServlet under bookstore1 on the left side of the Deployment Tool window.
    18. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    19. Click the field under Aliases then type /bookreceipt and press the Enter key.
    20. Click ShowCartServlet under bookstore1 on the left side of the Deployment Tool window.
    21. Click Add in the Aliases tab on the right side of the Deployment Tool window.
    22. Click the field under Aliases then type /bookshowcart and press the Enter key.
  12. Add Book Store 1 Web Application Context Listener to Web Archive File:

    1. Click bookstore1 on the left side of the Deployment Tool window.
    2. Click the Event Listeners tab on the right side of the Deployment Tool window.
    3. Click Add in the Event Listeners tab.
    4. Click the field under Event Listener Classes then click listeners.ContextListener.
  13. Add Book Store 1 Web Application Error Mappings to Web Archive File:

    1. Click bookstore1 on the left side of the Deployment Tool window.
    2. Click the File Refs tab on the right side of the Deployment Tool window.
    3. Click Add Error at the bottom of the File Refs tab.
    4. Click the field under Error/Exception then type exception.BookNotFoundException.
    5. Click the field under Resource to be Called then click /errorpage.html.
    6. Click Add Error.
    7. Click the field under Error/Exception field then type exception.BooksNotFoundException.
    8. Click the field under Resource to be Called then click /errorpage.html.
    9. Click Add Error.
    10. Click the field under Error/Exception then type javax.servlet.UnavailableException.
    11. Click the Resource to be Called field then click /errorpage.html.
  14. Add Book Store 1 Web Application Filter Mappings to Web Archive File:

    1. Click bookstore1 on the left side of the Deployment Tool window.
    2. Click the Filter Mapping tab on the right side of the Deployment Tool window.
    3. Click Edit Filter List at the bottom of the Filter Mapping tab.
    4. Click Add Filter in the Servlet Filters dialog.
    5. Click the field under Filter Class then click filters.HitCounterFilter.
    6. Click the field under Filter Name and verify that HitCounterFilter appears.
    7. Click Add Filter.
    8. Click the field under Filter Class then click filters.OrderFilter.
    9. Click the field under Filter Name and verify that OrderFilter appears.
    10. Click OK.
    11. Click Add in the Filter Mapping tab.
    12. Click the Filter Name box in the Add Servlet Filter Mapping dialog then click HitCounterFilter in the popup list.
    13. Click Filter this Servlet.
    14. Click the Servlet Name box then click BookStoreServlet.
    15. Click OK.
    16. Click Add in the Filter Mapping tab.
    17. Click the Filter Name box in the Add Servlet Filter Mapping dialog then click OrderFilter in the popup list.
    18. Click Filter this Servlet.
    19. Click the Servlet Name box then click ReceiptServlet.
    20. Click OK.
  15. Add Book Store 1 Web Application Book Store JDBC Resource to Web Archive File:

    1. Click bookstore1 on the left side of the Deployment Tool window.
    2. Click the Resource Refs tab on the right side of the Deployment Tool window.
    3. Click Add in the Resource Refs tab.
    4. Click the field under Coded Name then type jdbc/BookDB.
    5. Click the field under Type then click javax.sql.DataSource.
    6. Click the field under Authentication then click Container.
    7. Verify that the field under Shareable is checked.
    8. Click the JNDI Name field then type jdbc/BookDB.
    9. Click File | Save in the Deployment Tool window.
    10. Click File | Exit.
  16. Deploy Book Store 1 Web Application Web Archive File on Application Server:

    1. Click Tools | Deployment | Deploy in the J2EE Tools window.
    2. Wait until Command deploy executed successfully appears in the Deploy Archive File window.
    3. Click X in the top right corner of the Deploy Archive File window.
  17. Run Book Store 1 Web Application Web Client:

    1. Click Tools | Arguments in the J2EE Tools window.
    2. Type /bookstore in the Input dialog then click OK.
    3. Click Tools | Run | Web Client.
    4. Wait until the Duke's Bookstore page appears in the browser window.
    5. Click Start Shopping.
    6. Click Duke: A Biography of the Java Evangelist.
    7. Click Add to Cart.
    8. Click Check Shopping Cart.
    9. Click Check Out.
    10. Click Submit Information.
    11. Wait until Thank you for purchasing books from us appears.
    12. Click Continue Shopping.
    13. Click X in the top right corner of the browser window.
  18. Undeploy Book Store 1 Web Application Web Archive File on Application Server:

    1. Click Tools | Deployment | Undeploy in the J2EE Tools window.
    2. Wait until Command undeploy executed successfully appears in the Undeploy Archive File window.
    3. Click X in the top right corner of the Undeploy Archive File window.
  19. Stop Application Server:

    1. Click Tools | Application Server | Stop in the J2EE Tools window.
    2. Wait until JMS service shutdown complete appears in the Start Application Server window.
    3. Click X in the top right corner of the Start Application Server window.
    4. Click X in the top right corner of the Stop Application Server window.
  20. Display Books Database Table:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Execute above the Enter SQL Commands area in the PointBase Console window.
      2. Verify that the inventory field to the right of the title field containing Duke: A Biography of the Java Evangelist now contains 19.
      3. Click X in the top right corner of the PointBase Console window.
      4. Click Yes in the Console Exit dialog.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click the Enter field in the Database Command Line Interface window then press the Up Arrow key.
      2. Verify that select * from books; appears in the Enter field and press the Enter key.
      3. Verify that the inventory field to the right of the title field containing Duke: A Biography of the Java Evangelist now contains 19.
      4. Click the Enter field then type exit; and press the Enter key.
      5. Click X in the top right corner of the Database Command Line Interface window.
  21. Stop Database Server:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click the Enter field in the Database Server window then type x in the field and press the Enter key.
      2. Wait until PointBase Server Stopped appears in the Database Server window.
      3. Click X in the top right corner of the Database Server window.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database Server | Stop in the J2EE Tools window.
      2. Wait until Command stop-database executed successfully appears in the Stop Database Server window.
      3. Click the X in the top right corner of the Stop Database Server window.
 

 
Get J2EE Tools from Field Bird at SourceForge.net Previous  Table of Contents  Next