Skip to main content

ATG - quick reference to commonly used DSP Tags

In this blog, I would like to give a quick reference to the most commonly used DSP Tags.Note that in this DSP tag details :
  • bean refers to a Nucleus path, component name, and property name
  • param refers to a Page parameter
  • value refers to a Static-value
  • var refers to a EL variable
  • id refers to a scripting variable
==============================================================
1.dsp:importbean


   example: <dsp:importbean bean="/atg/dynamo/droplet/Switch"/>

==============================================================

2.dsp:page

   usage: It encloses a JSP. The dsp:page invokes the JSP handler, which calls the servlet pipeline and generates HTTPServletRequest.

  example:   <dsp:page> ..... </dsp:page>

==============================================================

3.dsp:include


   usage: Embeds a page fragment in a JSP.

   example:  <dsp:include src="/myPage/ResultPage.jsp" flush="true">  
                    <dsp:include page="../common/i18nInclude.jsp">

 ==============================================================

4.dsp:setvalue

   usage: Lets you set a bean property or page parameter with a value copied from another bean property, page parameter, or constant

   syntax: <dsp:setvalue target-spec [source-spec] />
            target-spec  --> bean  or  param
            source-spec  --> beanvalue="property-spec"  or   paramvalue="param-name"   or   value="static-value"

   example: <dsp:setvalue param="currLocale" beanvalue="/atg/userprofiling/Profile.locale" />
                   <dsp:setvalue bean="Student.name" paramvalue="currentName"/>

==============================================================

5.dsp:getvalueof


   usage: Creates an EL variable or a scripting variable

   syntax: <dsp:getvalueof  source-value  var-spec [data-type] />
             source-value  --> bean  or  param  or value
             var-spec --> var="EL variable"   or  id="scripting variable"
             data-type  --> vartype="java.lang..."  or  idtype="java.lang..."

   example: <dsp:getvalueof id="locale" bean="/atg/userprofiling/Profile.locale">
                          .....<%=locale%>...
                  </dsp:getvalueof>
  <dsp:getvalueof var="backgroundcolor" bean="Profile.preferredColor" vartype="java.lang.String">
                             <body bgcolor="${backgroundcolor}" >
  </dsp:getvalueof>

==============================================================

6.dsp:droplet


   usage: Lets you invoke a servlet bean from a JSP page

   syntax: <dsp:droplet [var-spec] name="servlet-bean" >
  ...
</dsp:droplet>
var-spec  --> var="EL variable"   or  id="scripting variable"
var --> Names an EL-accessible Map variable, which holds a servlet bean’s parameters and parameter values.

   example: <dsp:droplet var="fe" name="/atg/dynamo/droplet/ForEach">

==============================================================

7.dsp:param


   usage: Stores a value in a parameter to a servlet bean (mainly droplets) or as a page parameter

   syntax: <dsp:param name="param-name" param-value />
                  param-value -->  bean   or    param  or    value

  example: <dsp:droplet name="/atg/dynamo/droplet/IsNull">
                    <dsp:param name="value" param="locale"/>
<dsp:include src="/myPage/ResultPage.jsp" flush="true">
                      <dsp:param name="results" bean="ProductCatalogQueryFormHandler.results"/>

==============================================================
8.dsp:oparam


   usage: Specifies content to be rendered by an enclosing dsp:droplet tag. dsp:oparam (open parameter) takes the value supplied to it in a JSP and passes it to the current dsp:droplet tag. Each servlet bean maintains a set of open parameters which the servlet bean can set, service, and deliver as output to a JSP.

   syntax: <dsp:oparam name="param-name">
                    ...
</dsp:oparam>

   example: <dsp:droplet name="Switch">
                     <dsp:param name="value" param="person.hasCar"/>
    <dsp:oparam name="false">
 No vehicle
           </dsp:oparam>

==============================================================
9.dsp:form


   usage: Lets you set up a form that accepts user inputs, which are saved as component properties.

   syntax:  <dsp:form  method="{get|post}" [action="jsp-page"]  [synchronized="component-spec"]
                        [formid="id"]  [requiresSessionConfirmation="{true|false}"]/>

    synchronized --> Specifies the Nucleus path and name of a component that is blocked from accepting other form submissions until this form is submitted.
    formid --> Assigns a unique identifier to the form. Forms require unique identifiers when a page specifies multiple forms and conditionally displays only one of them.
    requiresSessionConfirmation  --> If set to true, prevents cross-site attacks

   example: <dsp:form method="post" action="servbeantest.jsp" synchronized="/samples/Student"/>

==============================================================
10.dsp:input


   usage: All dsp:input tags must be embedded between <dsp:form>..</dsp:form> tags, which are either in the same JSP or a parent JSP.

   syntax:  <dsp:input [type="input-control"] [name="input-name"]   bean="property-spec" ["source-spec"]
                       [checked="{true|false}"]  [default="value"]  [priority=integer-value]/>

    type --> text  or checkbox  or  radio  or hidden  or submit or  image(defines a submit control that uses the image)
    name --> For all input types other than radio and checkbox, the assigned name must be unique.
   bean --> The bean attribute for a submit control can also specify a form handler operation such as cancel or update
   source-spec --> Specifies to prepopulate the input field from  beanvalue  or paramvalue  or value . If source-value is omitted, the input field contains the target property’s current value.
   checked  --> If set to true, displays a checkbox or radio button as selected.
   default --> Specifies a default value to save to the component property if the user neglects to supply a value
   priority --> Specifies the priority of this input field during form processing

   example:
    <dsp:input bean="StudentFormHandler.updateSuccessURL" type="hidden" value="index.jsp"/>
    <dsp:input tabindex="2" type="text" id="searchinput" name="searchinput" bean="SearchValidateFormHandler.searchString"  maxlength="1000" priority="10"  value="<%=defaultKeyword%>"  onfocus="clearTextArea(searchbutton,searchinput)" />
    <dsp:input bean="SearchValidateFormHandler.validate" name="validate" id="validate" type="hidden" value="DAS" style="display:none" priority="-10"/>
    <dsp:input type="submit" bean="StudentFormHandler.create" value="Register"/>
    <dsp:input type="radio" name="sex" id="male" bean="SearchValidateFormHandler.gender" />
    <dsp:input type="radio" name="sex" id="female" bean="SearchValidateFormHandler.gender" />

==============================================================
   
11.dsp:valueof


   usage: renders a value in a bean property or page parameter

   syntax: <dsp:valueof value-source>
 [default-value]
</dsp:valueof>
                 value-source  --> bean  or  param  or value

   example:  <dsp:valueof param="currentName">Happy User</dsp:valueof>
         <h4><dsp:valueof bean="SearchDisplayDroplet.departmentLabel"/></h4>
 <input type="hidden" name="firstFacetLabel" value="<dsp:valueof param="firstFacetLabel"/>" id="firstFacetLabel"/>

==============================================================

12.dsp:textarea


   usage: lets you create an extended text box that for multi-line input

   example: <dsp:textarea bean="Student.disciplinaryAction" default="None"/>

==============================================================

13.dsp:a


   usage: It can also update a servlet bean property value and pass a page parameter to the destination page.

  syntax:  <dsp:a link-destination> link-text [param-list]   [property-settings]  </dsp:a>
 
link-destination  --> href ( resolves absolute paths using the Web server doc root as a starting point) or  page ( resolves absolute paths using the Web application root as a starting point)
        param-list  --> One or more embedded dsp:param
        property-settings  --> specifies settings for one or more bean properties.

   example: <dsp:a href="homepage.jsp">Go to your home page
  <dsp:param name="city" beanvalue="Profile.homeAddress.city"/>
  </dsp:a>

==============================================================

14.dsp:select and  dsp:option


   example: <dsp:select bean="Student.Summerhobbies" multiple="true" nodefault="true" priority="10">
                     <dsp:option value="hiking">hiking</dsp:option>
                    <dsp:option value="biking">biking</dsp:option>
     <dsp:option value="swimming">swimming</dsp:option>
 </dsp:select>

==============================================================


Comments

  1. Hi ,
    You are doing a great job by posting such beautiful information. Being a newbie in ATG, these topics help me very much. You are doing a wonderful job. keep posting. God Bless you.

    ReplyDelete
  2. Really nice article. very helpful.
    Droplets, DSP tags, frorm handlers & ATG... :D

    ReplyDelete
  3. Really good Ariticle...
    Super up Admin.....

    ReplyDelete
  4. Thank you all.... cheers.... :-)

    ReplyDelete
  5. admin we need more notes about ATG with real time example can you...?

    ReplyDelete
  6. we need more information with real time example program admin...

    ReplyDelete
  7. Hi,
    Anyone knows how can I disable a dsp:input?

    ReplyDelete

Post a Comment

Popular posts from this blog

Basic design decisions for a commerce search setup ( with an ATG Search view)

In this blog I would like to explain the basic set of configuration/design decisions needed to setup an ATG search project. Most of these design decisions are common for all Enterprise search applications. 1. Decide the searchable properties :   This means the properties that the business want the user to search in the ecommerce platform. In ATG search these are configured as the text properties in the product-catalog-output-config.xml ( the definitionFile of the \atg\commerce\search\ProductCatalogOutputConfig). Usually the displayName of product/sku, displayName of department/category/sub-category, skuId, brandName are the properties configured as searchable. 2. Decide the search refinement properties or the faceted properties :   After a user search for a keyword, search refinement is the next step done to filter his results. ATG supports the search refinement using the Faceted Search concept. Read more about facted search @...

ATG - more about Forms and Form Handlers

An ATG form is defined by the dsp:form tag, which typically encloses DSP tags that specify form elements, such as dsp:input that provide direct access to Nucleus component properties. Find below a sample dsp:form tag.    <dsp:form action="/testPages/showPersonProperties.jsp" method="post" target="_top">      <p>Name: <dsp:input bean="/samples/Person.name" type="text"/>      <p>Age: <dsp:input bean="/samples/Person.age" type="text" value="30"/>      <p><dsp:input type="submit" bean="/samples/Person.submit"/> value="Click to submit"/>    </dsp:form>   When the user submits the form, the /samples/Person.name property is set to the value entered in the input field.Unlike standard HTML, which requires the name attribute for most input tags; the name attribute is optional for DSP form element tags. If an input tag omits the n...

Lucene, sample JAVA code to Search an indexed file folder

Please find below the Lucene sample JAVA code to search the files inside a folder. This code will search the indexed folder for a search query in an indexed field. This java code is expecting the index path ( where the index files were created ) , field which need to be searched and the query need be searched as program arguments like  "java SearchFiles [-index dir] [-field f] [-query string]" . import java.io.File; import java.util.ArrayList; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.Version; public class SearchFiles { public static void main(Stri...

Display date and time for a DATE field @ SqlDeveloper

For date fields, by default SQL Developer will display only the date without time. To set it to display the time as well, do the following: Go to SQL Developer –> Tools >> Preferences. Select Database >> NLS Parameters from the left panel. From the list of NLS parameters, enter DD-MON-RR HH24:MI:SS into the Date Format field. Save and close

GC Log Analyzer from IBM

This blog is about the GC( garbage collection) log analyzer from IBM. If you have a GC log and you want to analyze the file,  this IBM tool will help you with some graphical analyzer and some recommendations. You can download it from the following URL : https://www.ibm.com/support/pages/ibm-pattern-modeling-and-analysis-tool-java-garbage-collector-pmat Please find below some screenshots and details that might help you. 1. Screenshot 1: 2. Screenshot 2 : 3. Screenshot 3 : 4. Screenshot 4: