8

The docs contain a detailed TCDL reference for SmartTarget tags, however I am not rendering my pages at publish time, and want to use the JSP tag libs directly in my page view code. Does anyone have some examples to get me started - I would have guessed to just use a similar syntax to the TCDL, but there seems to be some differences (TCDL has a region tag, but the taglib not, for example).

2 Answers 2

12

The shortest possible SmartTarget promotions implementation with JSP tags is as follows. This indeed looks a lot like the TCDL tags.

source

<smarttarget:query siteEditTagName="span" publication="tcm:0-72-1"> 
    <smarttarget:promotions region="Homepage Banners" maxItems="1"> 
        <smarttarget:itemTemplate> 
            <smarttarget:promotionalItems> 
                <smarttarget:itemTemplate>
                    <span>
                        <!-- Start Promotion: { "PromotionID": "${item.promotionID}", "RegionID" : "${item.region}"} -->
                        <tridion:ComponentPresentation pageURI="tcm:72-6212-64" componentURI="${item.componentUri}" templateURI="${item.templateUri}"/> 
                        <!-- End Promotion -->
                    </span>
                </smarttarget:itemTemplate> 
            </smarttarget:promotionalItems> 
        </smarttarget:itemTemplate> 
    </smarttarget:promotions> 
</smarttarget:query> 

Here are some other examples, all are showing the same thing: one SmartTarget region which queries for promotions, Eperience Manager Markup and three fallback component presentations.

The <tcdl:region> tag in the Dreamweaver TBB creates the TCDL source. The TCDL tags create the JSP tags. The JSP tags creates the HTML output with XPM markup (example).

4

There is a TLD file on the CD layout (Content Delivery\java\web\tld) which provides the list of tags, their attributes, and remarks explaining the purpose of each of them.

Combine that with the API documentation available on LiveContent (login required) and you should have a complete picture on how to use the tags in your web application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.