Input JSP pages
Information about input JSP pages follows.
- Four JavaScript functions required on input JSP pages
- File name and location
- common.jsp
- Tools Framework information
- Helper JSP files available
- functions common to helper JSP files.
Four JavaScript functions required on input JSP pages
A report input page, which is a dialog panel, must have a set of components for input criteria and implement the following four java script functions:
- initializeValues()
- Called every time the page is loaded.
- savePanelData()
- Called every time a user exits from this page.
For more information see savePanelData JavaScript function
- validatePanelData()
- Called before sending criteria to the reporting framework.
- visibleList()
- Called when the reporting framework requires a change in the visibility settings of components on this page.
File name and location
A report input JSP file should be named ReportNameReportInputView.jsp, and should be located in the following directory: WC_eardir/CommerceAccelerator.war/tools/reporting. The input JSP pages for the default reports that ship with WebSphere Commerce are also in this directory. You can reference these pages as examples.
common.jsp
You must include the file common.jsp in all input and output JSP pages. This JSP page provides functionality that is required by input and output JSP pages, for example, the creation of some objects used in the report generation process.
Tools Framework information
An input JSP file is usually a dialog panel, although it may also be a Wizard. A dialog panel contains two sections; an HTML contents-generating section, and a JavaScript function section. In the HTML section, you may call generateInputComponent for each component you want show on the input screen. In the JavaScript section, initializeValue, savePanelData, and validatePanelData should call the corresponding JavaScript functions defined in each input component. The function initializedValue is called when the page loads. The tools framework calls the savePanelData and validatePanelData functions. SavePanelData should call the following report framework required JavaScript functions:
- setReportFrameworkOutputView("DialogView");
- setReportFrameworkParameter("XMLFile","reporting.OutputPanelName")
- setReportFrameworkReportXML("reporting.ReportDefinitionXML");
- setReportFrameworkReportName("SQLName");, which is specified in reportNameReport.xml
You may also call setReportFrameworkParameter("name", value) to set parameters that are required by the report output JSP file. It is a name and value pair. All labels passed into generator and value in setReportFrameworkParameter function calls are keys that will be mapped into correct string based on locale and language preference. The map is defined in the properties file Reports_en_US.properties in the following directory:
WC_eardir/properties/com/ibm/commerce/tools
/reporting/propertiesHelper JSP files available
You must include the helper JSP files that you want to use in your input JSP file.
If using helper JSP files, your input JSP file must include ReportFrameworkHelper.jsp.
For more information see Helper JSP files provided for WebSphere Commerce Accelerator reports and Add a helper JSP file to an input page.
Functions common to helper JSP files
All these components provided common interface for JSP page developers:
- JSP function:
String generateInputComponent(String containerName, Hashtable reportsRB, String label1 [, String label2])This function creates a component on the input view. The InputComponent is the name of a component. Each component has a containerName, which is a unique name that identifies the JavaScript object for this component. All JavaScript functions will refer to containerName. All components require a reports resource bundle, reportsRB which reflects current language preferences. Each component has at least one title mapped from labels.
- JavaScript functions:
- onLoadInputComponent(containerName)
- This function will be called when the page loads. If this is the first time the page is being loaded within the transaction then initialize the InputComponent (from the data bean). If this page is being reloaded within the transaction then retrieve the saved data.
- validateInputComponent(containerName)
- This function should be called before you submit a request. It validates this component's input data. If the data is not valid, it displays a dialog window with appropriate message to remind the user. It returns true if the data is valid, or false if any part of the data is not valid.
- saveInputComponent(containerName)
- This function should be called whenever you navigate to another page different from the current page. It will save the current input data of the component for later retrieval when the user navigates back to the current page.
- visibleList(state)
- Call back function. It is called when the framework wants to display selection boxes or hide selection boxes on the page. This function should call setSelectComponentVisible.
- setSelectComponentVisible(container, state)
- Defined in each input component in which selection box is used. All input components have the same implementation with different names:
function setSelect<Component>Visible(container, state) { document.forms[container].ProductHelperSelectBox.style.visibility = state; }
Related concepts
Related tasks
Related reference