Add a wizard
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:
- 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
- WCDE_installdir/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.
- 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
- WCDE_installdir/xml/tools/componentname
Make an entry similar to the following in resources.xml:
<XML 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, also update the WebSphere Commerce configuration file to register any new resources.xml files.
This Sample: Wizard resources.xml file defines several wizards.
- 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. - 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, write a custom viewCommand.
- 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.
- 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
- WCDE_installdir/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 3If 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
- (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.
- 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.
- Launch and test your wizard by doing the following:
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.
Related concepts
Related tasks
Related reference