Add a dialog

The following files are created or modified by creating a dialog:

Files created:

Files modified:

To add a dialog:

  1. Create a dialog definition XML file that describes the flow among panels and data bean usage. Create the file, for example, named newDialog.xml, in the WC_installdir/xml/tools/componentname, where componentname is the name of the component to which the dialog belongs.

    For more information, see Dialog definition.

  2. Register the dialog definition XML file in the appropriate resources.xml file.

    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="sampleDialog" file="componentname/newDialog.xml"/>

    The name attribute becomes a key which will be used in a future 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 required JavaScript functions:

    Function Name Description
    savePanelData() Stores HTML form data into model (parent frame). This function savePanelData() must be supplied in each content frame to save the current panel's data in the model.
    validateNotebookPanel() An optional function which validates data entered by user.

  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. If the dialog is called using a viewCommand, write a custom viewCommand.

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

  5. Register 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 adding text that appears as the title of the dialog. 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 dialog.

    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 dialog and update a Tools User Interface Center help map XML file to include your help files. See Add context-sensitive help into the Tools User Interface Center for more information.

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

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

    Stop and start WebSphere Commerce then test your new dialog. This is the URL of the newly created dialog:

    https://host_name:8000/webapp/wcs/tools/servlet/DialogView?XMLFile=namespace.myTestDialog,

    where namespace is defined in resources.xml.

Related concepts

Related tasks

Related reference