This JSP example shows how to build a form from a search results list and let the user check off multiple products on the form and add them to a product comparison list.

Each product the user checks off on the form is added to productIdList, which stores the list of repository IDs for the products to add to the comparison list when calling either ProductListHandler’s handleAddProductList method or handleAddProductListAllSkus method. In this example, the handleAddProductList method is called. (For more information on ProductListHandler’s handle methods, refer to Managing Product Comparison Lists.)

<dsp:importbean bean="/atg/commerce/catalog/comparison/ProductListHandler"/>
<dsp:importbean bean="/atg/commerce/catalog/SearchFormHandler"/>

<dsp:form action="compare.jsp" method="POST">
<dsp:droplet name="ForEach">
  <dsp:param bean="SearchFormHandler.searchResults" name="array"/>
  <dsp:param value="+displayName" name="sortProperties"/>

  <dsp:oparam name="outputStart">
    <table border=0 cellpadding=0 cellspacing=0>

  <dsp:oparam name="output">
      <dsp:input bean="ProductListHandler.productIdList"
           paramvalue="element.repositoryId" type="checkbox"/>
      <dsp:valueof param="element.displayName"/> - <dsp:valueof

  <dsp:oparam name="outputEnd">
    <dsp:input bean="ProductListHandler.addProductList" value="Add to list"

loading table of contents...