This section provides an example of a JSP that returns content to a Legacy REST Web Services client. The JSP invokes a servlet bean to return data that it will incorporate into the output it sends to the REST client. In this example, the JSP uses the /atg/commerce/catalog/ProductLookup component to return repository data to the REST client.

See comprehensive information about developing JSPs for the Oracle Commerce Platform application in the Page Developer's Guide.

<%-Import the dsp tag library to access Oracle ATG Web Commerce
     functionality. Import tag libraries for the output format you
     will send to REST clients. --%>

<%@ taglib prefix="dsp" uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_1" %>
<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>
<%@page contentType="application/json"%>

<dsp:page>

  <%-Import a servlet bean component you will use with the
       dsp:droplet element --%>

  <dsp:importbean bean="/atg/commerce/catalog/ProductLookup"/>
  <dsp:droplet name="ProductLookup">

    <%-These two parameters are passed to the JSP by the URL
         recoding template. --%>

    <dsp:param name="id" param="productId"/>
    <dsp:param name="aString" param="myString"/>

    <%-Write the output for REST clients using the values returned
         by the servlet bean. --%>

    <dsp:oparam name="output">
      <json:object name="product">
        <json:property name="displayName">
          <dsp:valueof param="element.displayName"/>
        </json:property>
        <json:property name="someString">
          <dsp:valueof param="aString"/>
        </json:property>
      </json:object>
    </dsp:oparam>
  </dsp:droplet>
</dsp:page>

Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices