Add a search dialog
- Create a search dialog definition XML file to configure the contents of the search criteria panel and a URL of the result panel. Create the search dialog definition XML file based on the following DTD file:
- WC_installdir/xml/tools/common/SearchDialog.dtd
- WCDE_installdir/xml/tools/common/SearchDialog.dtd
To configure the contents of the criteria panel, and to specify a URL to display the result panel. This file must be in the following directory:
- WC_installdir/xml/tools/componentname
- WCDE_installdir/xml/tools/componentname where componentname is the name of the component to which the search dialog belongs.
For more information, refer to Search dialog definition.
- Register the search dialog definition XML files in the following file:
- WC_installdir/xml/tools/componentname/resources.xml
- WCDE_installdir/xml/tools/componentname/resources.xml
This search dialog definition XML file must be registered here in order to function. The resources.xml file is referenced in the WebSphere Commerce configuration file. Create an entry similar as below:
<XML name="sampleSearchDialog" file="componentname/sampleSearchDialog.xml" />- Create a resource bundle with text for the search 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 search 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
- If the attribute beanMethod is defined in the XML file, then write a criteria data bean implementing com.ibm.commerce.tools.common.ui.SearchDialogCriteriaBean. This data bean is used to populate the displaying text for the criteria panel. For <jsMessage>, String type is expected to be returned from the beanMethod. For field type of select-one, select-multi and radio, the return type expected is Hashtable.
- SearchDialogCriteriaBean is extended from SmartDataBean, that means at least getCommandContext(), setCommandContext(), getRequestProperties(), setRequestProperties(), and populate() methods must be implemented.
For an example, refer to Sample Search dialog SearchDialogCriteriaBean.
- Write JavaScript functions to validate user inputs, and save additional data that may be required. In this JavaScript file (as specified in the search dialog definition XML file), the following functions may be implemented:
Function Name Return Type Description userSavePanelData() N/A (Optional) All the criteria input fields will be saved automatically. If additional data must be saved, you may save their data in this function. userValidatePanelData() Boolean Programmers may validate all the required criteria fields in this function. If it is valid, return a true value, otherwise return a false value. - Write context sensitive help files 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.
- Write a JSP result page to process user inputs and display the result list. This page is usually a dynamic list. Also write the necessary data beans to handle the criteria fields passed by tools framework. There are two ways for programmers can retrieve the criteria fields. One is from the request parameters, and the other way is through the request properties object.
- Add your new wizard 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.
Related concepts
Related tasks
Related reference