Add a notebook

The following files are created or modified by adding a notebook:

Files created:

Files modified:

To add a notebook:

  1. Create a notebook definition XML file that describes the flow among panels and data bean usage. Create the file, named newNotebook.xml for example, in the directory

    • WC_installdir/xml/tools/componentname

    • WCDE_installdir/xml/tools/componentname where componentname is the name of the component to which the notebook belongs.

    For more information, see Notebook definition

  2. Register the XML file in the resources.xml file for the component that you are modifying. Multiple versions of this file exist, one for each component, in the following directory:

    Make an entry similar to the following in resources.xml:

    <XML name="myNotebook" file="componentname/newNotebook.xml" />

    The name attribute becomes a key which will be used in a later step.

    Since the WebSphere Commerce configuration file references the resources.xml files, also update the WebSphere Commerce configuration file to register any new resources.xml files.

  3. Write panels using JSP files and JavaScript. These JSP files define the panels that display in the content frame into which users enters data. The following table describes the JavaScript functions for these panels:

    Function Name Description
    savePanelData() (Required) Stores HTML form data in the parent frame. The function savePanelData() must be supplied in each content frame to save the current panel's data in the model.
    validateNoteBookPanel() (Optional) Validates data entered by user. This method should return true or false.

    At the end of the onLoad event, parent.setContentFrameLoaded(true) must be called. This ensures that the entire content panel loads before the user can move to another panel.

  4. Write custom commands to update the database and perform custom functionality. These commands update the database with the information entered, or perform some function when the user clicks OK. Also, if you chose your panel URL in your notebook XML file to be a viewCommand, write a custom viewCommand.

    See Example: Wizard, dialog or notebook controller command for more information.

  5. Register your custom commands and JSP files in the database. Once any required commands are created, register them in the database. Ensure that the URL field in the database matches the value of the finishURL attribute in your XML file. For details on how to register commands see Design patterns.

  6. Create a resource bundle by adding text to name each panel. This text appears on the notebook map in the table of contents frame, titling each panel. In this case, keys are based on the panel names given in your notebook XML file created in step 1. These files are in the following directory:

    • WC_eardir/properties/com/ibm/commerce/tools/componentname/properties

    • WCDE_installdir/properties/com/ibm/commerce/tools/componentname/properties

    where componentname is the component to which you are adding the notebook.

    The following is an example resource bundle for the XML file defined in Notebook definition.

    # Panels name for TOC panel
    initiativeGeneralPanel=General
    initiativeLocationPanel=Location
    initiativeConditionsPanel=Conditions
    

    If national languages are supported, create the national language resource bundles with the appropriate language text. The national language file names must end with the locale supported. For example, for a French-language resource bundle, the file name should be filename_fr_FR.properties

  7. (Optional) Write context sensitive help files for your container element and panels and update the Tools User Interface Center help map XML file to include your help files. See Add context-sensitive help into a Tools User Interface Center for more information.

  8. Add your new notebook to a Tools User Interface Center menu system (for example, WebSphere Commerce Accelerator). Refer to Integrating tools into a Tools User Interface Center for more information.

  9. Launch and test your notebook by doing the following:

    Stop and start WebSphere Commerce to test your new notebook. This is the URL of the newly created notebook: https://host_name:8000/webapp/wcs/tools/servlet/NotebookView?XMLFile=sample.myTestNotebook ,

    where sample is a namespace defined in resources.xml.

Related concepts

Related reference