Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Notebooks
Add a notebook
The following files are created or modified by adding a notebook:
Files created:
- a notebook definition XML file, newNotebook.xml, to describe the notebook panels' default flow.
- resource bundle files, for example, MySampleResource_locale.properties
- HTML help files
- custom Java command files, for example, MyCommand.java
- JSP and Javascript files to fill panel contents, for example, myPanel.JSP and myPanel.js
Files modified:
- resources.xml
- Tools User Interface Center menu XML file to display the new notebook
- Tools User Interface Center Help Map XML file to include the help files
Procedure
- 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_INSTALL/xml/tools/componentname
- workspace_dir/wc/xml/tools/componentname where componentname is the name of the component to which the notebook belongs.
For more information, see Notebook definition
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,...
- WC_INSTALL/xml/tools/componentname/resources.xml
- workspace_dir/wc/xml/tools/componentname/resources.xml
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.
- 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.
- 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 the panel URL in the notebook XML file to be a viewCommand, write a custom viewCommand.
See Example: Wizard, dialog or notebook controller command for more information.
- Register the custom commands and JSP files in the database. Once required commands are created, register them in the database. Verify the URL field in the database matches the value of the finishURL attribute in the XML file. For details on how to register commands see Design patterns.
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 the notebook XML file created in step 1. These files are in the following directory:
- WC_EAR/properties/com/ibm/commerce/tools/componentname/properties
- workspace_dir/wc/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
- Optional: Write context sensitive help files for the container element and panels and update the Tools User Interface Center help map XML file to include the help files. See Add context-sensitive help into a Tools User Interface Center for more information.
- Add the new notebook to a Tools User Interface Center menu system (for example, WebSphere Commerce Accelerator). Refer to Integrate tools into a Tools User Interface Center for more information.
- Launch and test the notebook:
Stop and start WebSphere Commerce to test the 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