The wcpgl:widgetImport
tag allows one or more widgets to be
imported at a time. The widgets can be imported based on the slot ID parameter or the widget
identifier parameter.
The Commerce Composer framework handles the specified slot ID
parameter values as the higher priority than the widget identifiers. The framework uses the tag to
identify and retrieve the widget definitions for the widgets with the specified slot ID. If no
widgets match the slot ID values, the widget identifier values are used to retrieve the widget
definitions. Once the widget definitions are found, the JSP file path in the definitions is used to
import the widgets. If no widget definition cannot be found with the slot ID or widget identifier
values, then no widget is imported. If the debug mode is set to true
, an error
message displays on the store page.
You can use the Commerce Composer widget import tag for the following purposes:
The tag extends the functionality of the
c:import
tag, which supports
importing a JSP file by using the
URL
attribute. The
widgetImport
tag supports importing a JSP file by using either the
URL
attribute, the layout
definition, or the widget definition. The order of priority for importing JSP files is:
URL
- If this attribute is not null, then the JSP associated with the attribute
is imported. No further processing is done.
slot ID
- If this attribute is set, widgets are imported based on the layout
definition and the widgets that are associated with the slot ID. If the slot ID is set, multiple
widgets can be imported for the slot ID. The widgets are imported sequentially.
identifier
- If the widget definition cannot be found with the slot ID, or if
slot ID is null, the identifier is used to find the widgets to import.
Tag information
Tag information |
Body Content |
empty |
Attributes
Name |
Required |
Request-time |
Type |
Description |
slotId |
false |
true |
java.lang.String |
The slot IDs of the widgets to be imported. |
identifier |
false |
true |
java.lang.String |
The widget identifier for the widgets to be imported. |
uniqueID |
false |
true |
java.lang.String |
The widget unique ID for the widgets to be imported. |
debug |
false |
true |
java.lang.String |
If the value for this attribute is set to false, no exception is thrown
and no error widget is displayed on the store page when the widget import fails. |
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. |
singletonKey |
false |
true |
java.lang.String |
The variable that holds the name of the key that is used to check whether a widget is already
imported. Use this attribute for a singleton feature, which is when a widget must be imported only
once in a request scope. This single import occurs even when there are multiple imports found in
different JSP files. Any subsequent import of the widget is ignored. Use this feature to include
widgets like the EnvironmentSetup or SearchSetup . The
singletonKey is used to identify whether a widget is already imported. Ensure that
the same value for the attribute is used across all widget imports that must be included only
once. |
The following table identifies attributes for the
wcpgl:widgetImport
tag, which are also defined for the
c:import
tag within the WebSphere Application
Server
c.tld
tag library definitions. Since the tag library definitions cannot be
extended, the attributes are redefined within the class for the
wcpgl:widgetImport
tag
c:import
tag attributes redefined for the
wcpgl:widgetImport
tag
Name |
Required |
Request-time |
Type |
Description |
url |
false |
true |
java.lang.String |
The URL of the resource to import. |
var |
false |
false |
java.lang.String |
The name of the exported scoped variables for the resource content. The type of the scoped
variable is String . |
scope |
false |
false |
java.lang.String |
The scope for the var attribute. |
varReader |
false |
false |
java.lang.String |
The name of the exported scoped variable for the resource content. They
type of the scoped variable is Reader . |
context |
false |
true |
java.lang.String |
The name of the context when a relative URL resource that belongs to a foreign context is
accessed. |
charEncoding |
false |
true |
java.lang.String |
The character encoding of the content at the input resource. |
EXAMPLE
This tag can be used within the container definition JSP file for a
layout template. You can use this tag within a container definition to identify whether a widget can
be included within a layout template slot. For example, the following code snippet, from the
ProductPageContainer.jsp file, defines slots for a layout template that is
intended for use in composing layouts for catalog entry pages. Within this file, the definition of
the template slots includes the wcpgl:widgetImport
tag to identify that a widget
can be included within this
slot:<div class="product_page_content rowContainer <c:if test='${foundCurrentSlot7 == true}'>bundle_package_page</c:if>"
id="container_${pageDesign.layoutID}" role="main">
<div class="row margin-true">
<div class="col12 slot1" data-slot-id="1"><wcpgl:widgetImport slotId="1"/></div>
</div>
<div class="row">
<div class="col6 acol12 slot2" data-slot-id="2"><wcpgl:widgetImport slotId="2"/></div>
<div class="col6 acol12 slot3" data-slot-id="3"><wcpgl:widgetImport slotId="3"/></div>
</div>