Customizing storefront JSP pages using the getData tag
JSP files can retrieve and display information from HCL Commerce services using the getData tag.
Before you begin
- Identify a custom or default HCL Commerce service you want to use to retrieve data. For more information, see Working with HCL Commerce SOI services
- Identify the custom or default expression builder to be used with the service, or create a new expression builder.
- Identify the storefront page you want to customize. If necessary, create and register a new JSP file.
About this task
Tip: The starter store pages, such as Consumer Direct JSP files, use the data
bean programming model for data retrieval. For example, existing starter store pages, such as
ProductDisplay.jsp, do not use the getData tag. However, you can add getData tags to these pages
retrieve additional information from your HCL Commerce services.
Procedure
- Open HCL Commerce Developer.
- In the Enterprise Explorer view, navigate to . Continue navigating to the subfolder where the JSP file you want to customize is located.
-
Locate the section of the page where you want to retrieve data, and add a getData tag, similar
to the following example.
In this example, the getData tag populates a variable named
catentries
with the data returned by a custom expression builder namedgetCatalogEntryWithWarranty
. The custom access profileMyCompany_All
is provided as a parameter to control the amount of data that is returned about each object.
For reference information about the getData tag, see Tag: getData.<wcf:getData var="catentries" type="com.ibm.commerce.catalog.facade.datatypes.CatalogEntryType[]" expressionBuilder="getCatalogEntryWithWarranty"> <wcf:contextData name="storeId" data="${WCParam.storeId}"/> <wcf:contextData name="catalogId" data="${WCParam.catalogId}"/> <wcf:contextData name="langId" data="${WCParam.langId}"/> <wcf:param name="catalogEntryId" value="${WCParam.catalogEntryID}"/> <wcf:param name="accessProfile" value="MyCompany_All"/> </wcf:getData>
- Optional:
If the getData tag returns a collection of objects, you can iterate over them using a forEach
loop tag, similar to the following example:
<c:forEach var="catalogEntry" items="${catentries}"> <!-- present details about each catalogEntry object in catentries --> </c:forEach>