Tag: jsInclude

The Commerce Composer framework uses this JavaScript Include Source tag to generate the source code to include all of the JavaScript files that are associated with widgets in a layout. The framework uses the tag to loop through all of the widgets in a layout to identify the JavaScript files that are associated with the widgets. The framework ensures that each JavaScript file is included only once in a page to avoid issues with the JavaScript code.
You can associate a JavaScript file that a widget depends on by defining a widget property within the widget definition XML to include the file. For example, the following definition XML includes the CatalogEntryRecommendation.js file for a widget:
<Definition>
<widget-property name="_pgl:javaScriptInclude">
<value>${staticAssetContextRoot}/Widgets/com.ibm.commerce.store.widgets.CatalogEntryRecommendation/javascript/CatalogEntryRecommendation.js</value>
</widget-property>
</Definition>

Tag information

Tag information
Body Content empty

Attributes

Name Required Request-time Type Description
varPageDesignDetails false true java.lang.String The variable name under which you can find the Page Design Logical SDO object. If this attribute is not provided, the default value of PAGE_DESIGN_DETAILS_VAR is used as the variable name. If this attribute is not defined and PAGE_DESIGN_DETAILS_VAR is not defined, then the tag cannot access the Page Design Logical SDO object.

EXAMPLE

Use this tag in the same main JSP where the entire layout template is imported with the wcpgl:widgetImport tag. You can use this tag to include all of the dependent JavaScript files that the widgets on the page depend on. The wcpgl:jsInclude tag can be used in the header section or near the footer of the page. For example,
<wcpgl:jsInclude varPageDesignDetails="pageDesign"/>