ATG Tag Library:DSP Tags
There are many ATG Out Of The Box(OOTB) droplets to cater the various needs in developing an application.Droplet’s main use in a jsp page is to dispay the contents dynamically. The OOTBox components are used in JSP with the help of DSP tags. DSP is a tag library provided by ATG, it acts as layer above the JSP tags. The DSP tag library lets you access all data types in ATG’s Nucleus framework. Other functions provided by these tags are managing transactions and rendering data in a Java Server Page. Tags from the DSP tag library are used only for tasks that involve Dynamo Application Framework (DAF) resources.
In the API documentation of ATG the class hierarchy is: atg.nucleus.GenericService —> atg.servlet.DynamoServlet. And the classes for sample droplets “Switch” and “ForEach” droplets are “atg.droplet.Switch” and “atg.droplet.ForEach” respectively. Before using the DSP tags in a page, it must be imported in the beginning of the page.
<%@ taglib uri=”/dspTaglib” prefix=”dsp”%>
DSP PAGE tag:
The dsp:page surrounds the content body of the JSP. It is required to use this tag as such whenever your pages include DSP tags.”dsp:page” tag initiates the page rendering process by creating an instance of the “DynamoHTTPServletRequest”. This tag is preceded only by the page directives and import statements.
["content of the page.It can be any dsp or jsp or html tags"]
DSP IMPORTBEAN tag:
dsp:importbean can import a servlet or java bean component into a JSP.It is usually given at the top of the page so that it facilitates reference to all other elements.The tag has 3 attributes BEAN,VAR and SCOPE, of which bean is a compulsory attribute and can’t be omitted.The bean attribute accepts a fully qualified nucleuspath and name of the servlet bean that we want to import. The VAR attribute names an EL variable so that it can be used by other tags in the page. If SCOPE is not mentioned a default page is used.SCOPE determines where the servlet bean specified by VAR is stored and who all can access it.PAGE,REQUEST,SESSION & APPLICATION are the various options available. Now a small eg: will serve a better understanding.
Sample Code:
<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
<dsp:importbean bean="/atg/dynamo/servlet/RequestLocale" var="requestlocale"/>
<dsp:importbean bean="/atg/dynamo/droplet/Redirect/>
<dsp:setvalue bean="${requestLocale.refresh}" value=" "/>
<dsp:droplet name="Switch">
<dsp:param bean="${requestLocale.locale.language}" name="value"/>
<dsp:oparam name="fr">
<dsp:droplet name="Redirect">
<dsp:param name="url" value="fr/index.jsp"/>
</dsp:droplet>
</dsp:oparam>
<dsp:oparam name="default">
<dsp:droplet name="Redirect">
<dsp:param name="url" value="en/index.jsp"/>
</dsp:droplet>
</dsp:oparam>
</dsp:droplet>
Here the Switch, RequestLocale and Redirect droplets are imported to the page. The RequestLocale component is imported to a VAR attribute so that the dsp:setvalue and dsp:param tags can access RequestLocale with EL. EL is enumerated language so it requires the EL tag libraries as well(JSTL).*
* Not going into the details of JSTL as it will divert from the aim of this article, which is just to provide an understanding of the main DSP tags and attributes.
Related posts:








How to retrive data from database using formhandler in ATG
Leave your response!