ATG Droplet

Retrieving ATG OOTB Droplet from jsp -

<%-- Importing Droplet --%>
        <dsp:importbean bean="/atg/commerce/catalog/ProductLookup" />
<%-- Using Imported Droplet --%>
            <dsp:droplet name="ProductLookup">
<%-- Passing parameters  --%>
            <dsp:param name="id" param="productId" />
<%-- Getting output parameter --%>
             <dsp:oparam name="output">
<%-- Retreiving value from output and set to a variable --%>
             <dsp:getvalueof var="productObject" param="element" scope="request" />
             <dsp:param name="product" param="element" />

Creating Droplet Component -

Example to create sample droplet and how to fetch from jsp. -
         $scope=request -

// java class should extend the DynamoServlet
         public class TestDroplet extends DynamoServlet {

// override the service method
            public void service(DynamoHttpServletRequest pRequest,
   DynamoHttpServletResponse pResponse) throws ServletException,
   IOException {

                   // we can set output parameter to pass the output to jsp page.
                   pRequest.setParameter("profile", "This is test droplet.");
                   pRequest.serviceLocalParameter("output", pRequest, pResponse);

TestDroplet.jsp -

<dsp:importbean bean="/testDirectory/TestDroplet" />
     <dsp:droplet name="TestDroplet">
           <dsp:param name="profile_input" value="learningwithadarsh" />
           <dsp:oparam name="output">
                <dsp:getvalueof param="profile"/>

Difference between serviceLocalParameter and serviceParameter

The parameters set by Servlet beans are only visible inside the Droplet <dsp:oparam> tag (unless set to an attribute).

If we are using nested droplets, dropletA inside dropletB :

<dropletA> - Output 'someoutput' defines to this droplet
  serviceLocalParameter : output parameter will not be accessable
           serviceParameter : we can access output parameter "someoutput" here.