Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Search dialogs


Add a search dialog


Procedure

  1. 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_INSTALL/wc.ear/xml/tools/common/SearchDialog.dtd

    • WC_PROFILE/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_INSTALL/wc.ear/xml/tools/componentname

    • WC_PROFILE/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.

  2. Register the search dialog definition XML files in the following file:

    • WC_INSTALL/wc.ear/xml/tools/componentname/resources.xml

    • WC_PROFILE/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" />
    


  3. Create a resource bundle with text for the search dialog. These files are...

    • 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 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

  4. 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.

    Note:

    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.

  5. 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.

  6. Write context sensitive help files 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.

  7. Write a JSP result page to process user inputs and display the result list. This page is typically a dynamic list. Also write the necessary data beans to handle the criteria fields passed by tools framework. There are two ways programmers can retrieve the criteria fields. One is from the request parameters, and the other is from the request properties object.

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


Related concepts

Search dialogs


Related tasks

Add a dialog

Related reference

Search dialog navigation behavior

Search dialog definition


+

Search Tips   |   Advanced Search