Adding a wizard

Complete the following steps to add a wizard.

About this task

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

Files created:

  • a wizard definition XML file that describes the panel flow, for example, newWizard.xml
  • resource bundle files, for example, MySampleResource_locale.properties
  • HTML help files for your users
  • custom Java command files, for example, MyCommand.java
  • JSP and JavaScript files to fill panel contents, for example myPanel.js and myPanel.JSP

Files modified:

  • resources.xml
  • Tools User Interface Center menu XML file to display your new wizard
  • Tools User Interface Center Help Map XML file to include your help files

To add a wizard:

Procedure

  1. Create a wizard definition XML file that describes the flow among panels and data bean usage. Create the file, for example named newWizard.xml, in the directory:
    • WC_installdir/xml/tools/componentname
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/componentname

    where componentname is the name of the component to which the wizard belongs.

    For more information, see the valid XML tags in the Wizard definition.


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

    • WC_installdir/xml/tools/componentname
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/componentname

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

    <resourceXML name="sampleWizard" file="componentname/newWizard.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, you must also update the WebSphere Commerce configuration file to register any new resources.xml files.

    This Sample: Wizard resources.xml file defines several wizards.


  3. Write JSP files for each panel, and JavaScript files as required. These JSP files define the panels that display in the content frame into which users enters data. All of the panels that you create must include the following JavaScript functions:

    Function Name Description
    savePanelData() Stores data from the HTML form into the object model in the parent frame.
    validatePanelData() Validates data entered by user.
  4. Write custom commands to update the database and perform custom functionality. These controller commands update the database with the information entered, or perform some function when the user clicks on the Finish button. See Example: Wizard, dialog or notebook controller command for more information.

    Also, if you chose your panel URL in your wizard XML file to be a viewCommand, you must write a custom viewCommand.

  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 adding text naming each panel. This text appears in the table of contents frame, titling each panel. These files are in the following directory:

    • WC_eardir/properties/com/ibm/commerce/tools/componentname/properties
    • WebSphere Commerce Developer workspace_dir/wc/properties/com/ibm/commerce/tools/componentname/properties

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

    The following is a example resource bundle based on the data from the wizard XML file in step 1.

    
    # Panels name for TOC panel
    Profile1=General
    Profile2=Description
    Profile3=Attributes
    Address=Address
    # Button Labels
    sampleButtonName1=Test Button 1
    sampleButtonName2=Test Button 2
    sampleButtonName3=Test Button 3
    

    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 Adding context-sensitive help into a Tools User Interface Center for more information.

  8. Add your new wizard 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 wizard:

    Stop and start WebSphere Commerce. Test the wizard by launched the menu registered in the previous step. Although not preferred, if it is necessary to launch the wizard outside of the Tools User Interface Center then the URL is:

    https:// host_name :8000/webapp/wcs/tools/servlet/WizardView?XMLFile= sample .sampleWizard

    where sample is a namespace defined in resources.xml.