Solutions Products Services

Search
Download Contact Us
Documentation Site map
Support About Us
E-commerce SolutionsiPlanet



Deploying and Executing the CDShopCart Forte for Java

In this section of the tutorial, you will deploy and execute an existing applicatin, named CDShopCart. The CDShopCart application is installed with the Forte for Java IDE under the path content root/sampledir/tutorial/CDShopCart.

Configuring Database

The CDShopCart interacts with a database to store and retrieve data. This subsection will show you how to configure the application with PointBase database that comes with Forte for Jave. You can get more information on how to configure it with other databases, such as Oracle Database version 8.1.6, from "Forte for Java, Community Edition Tutorial." To see that PointBase was installed, look for a pointbase directory under the directory where Forte for Java is installed. If PointBase was not installed, you can run the installer again to install it.

To configure PointBase database:

  1. Make sure that PointBase netserver is running. To start the netserver, select Tools | PointBase Network Server | Start Server from the menu.
  2. Start the PointBase console.
  3. In Solaris or Linux environments: Run the console.sh file in the forte4j-home/pointbase/client directory.

    On Microsoft Windows: Choose Start > Forte for Java EE > PointBase > Client Tools > Console or double-click the console.bat file in the forte4j-home/pointbase/client directory.

    The Connect To Database dialog box appears, showing values for the PointBase driver to the default sample database.

  4. Change the word sample at the end of the URL field to cdshopcart as shown.
  5. Select the Create New Database checkbox and click OK.
  6. From the File menu, select Open.
  7. Use the file browser to find the your-work-dirsampledir/tutorial/CDShopCart/SQLscripts/CDCatalog_pb.sql file and click Open.
  8. From the SQL menu, select Execute All.
  9. The message window confirms that the script was executed. (Ignore the initial messages beginning Cannot find the table... These appear because there are DROP statements for tables that have not been created yet. These DROP statements will be useful in the future if you want to rerun the script to initialize the tables.)

  10. Test that you have created the table by clearing the SQL entry window and typing:
  11. SELECT * FROM CD

  12. From the SQL menu, select Execute. Your console should display the CD table.
  13. Close the PointBase console window.

Configuring the Sample Code

In this subsection, you will update the sample code to work with PointBase database.

  1. From the Explorer Filesystems tab, mount the CDShopCart tutorial from the path: your-work-dir/sampledir/tutorial.
  2. Modify the taglib directive in the JSP files as follows:

    For ShopCart.jsp, the taglib directive should look like this:
    <%@taglib uri="/ietags" prefix="pr" %>

    For ProductList.jsp, the taglib directives should look like these:
    <%@taglib uri="/dbtags" prefix="jdbc" %>
    <%@taglib uri="/ietags" prefix="pr" %>

  3. Update URL for PointBase database as follows:
  4. In ProductList.jsp, update the URL for the database as follows:
    <jdbc:connection id="jdbcConn"
    driver="com.pointbase.jdbc.jdbcUniversalDriver"
    url="jdbc:pointbase://localhost/cdshopcart"
    user="PUBLIC" password="PUBLIC" />

    In CheckOutBean.java, update a call to setConnectionURL as follows:
    pmf.setConnectionURL("jdbc:pointbase://localhost/cdshopcart");

  5. (Optional) To make ProductList.jsp the main page, perform the following actions:
  6. Select WEB-INF node to view its Properties window.
  7. Enter a value fo the Context Root field, e.g., CDShopCart.
  8. The Context Root will be used in the URL when executing the web module.

    Deploying and Excuting the sample

    You will now deploy and excute the configured sample code.

    1. From the Filesystems tab, right click on the WEB-INF node, and select deploy.
    2. Right click on the ProductList JSP node, and select Execute.
    3. The Web Browser launches and displays the following screen:

      If you have performed the optional step 4 of the previous subsection, you can also visit the same page at http://serverinstance/NASApp/CDShopCart/

    NOTE: Please note that the Place Order page does not work because Transparent Persistence has not been added. Transparent Persistence is beyond the scope of this tutorial. For additional information, see Forte™ for Java™, Community Edition Tutorial.

     

    Legal Notices


    Search