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 Oracle ATG Web Commerce application in the ATG 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="" %>
<%@ taglib prefix="json" uri="" %>
<%@page contentType="application/json"%>


  <%-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 name="someString">
          <dsp:valueof param="aString"/>

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