I'm implementing functionality in SDL Tridion 2013 where the user is able to utilise a filter which in turn queries the broker for matching criteria and then returns the Component Presentations to the page. Each item returned contains a Dynamic link.

(the dynamic CPs were stored in the broker DB as HTML fragments by publishing.)

When I publish DCP and access the page used DCP, HTML tag which is used Tridion Tag is disappear.(refer to output HTML.)

To solve the above problem, I refer to the follow site. But i can't solove.


So, Please tell me how to solve the above problem.

The Java code is below.

package com.tridion.tag.news;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.tridion.broker.querying.*;
import com.tridion.broker.querying.criteria.*;
import com.tridion.broker.querying.criteria.metadata.*;
import com.tridion.dynamiccontent.ComponentPresentationAssembler;

public class NewsSearch implements Tag {
    private PageContext pageContext;
    private Tag parentTag;
    private String criteria;
    private ComponentPresentationAssembler cpAssembler;
    private String componentId;
    private String componentTemplateURI = "tcm:19-1149-32";

    public void setPageContext(PageContext pageContext) {
        this.pageContext = pageContext;

    public Tag getParent() {
        return this.parentTag;

    public void setParent(Tag parentTag) {
        this.parentTag = parentTag;

    public void setCriteria(String criteria) {
        this.criteria = criteria ;

    public int doStartTag() throws JspException {
        try {
            JspWriter writer=pageContext.getOut();
            // create criteria
            CustomMetaKeyCriteria keyCriteria = new CustomMetaKeyCriteria("date");
            CustomMetaValueCriteria modelCriteria = new CustomMetaValueCriteria(keyCriteria, criteria, "yyyy",Criteria.NOT_EQUAL);
            // create query
            Query query = new Query(modelCriteria);
            // execute query
            String[] queryResult = query.executeQuery();
            if (queryResult != null) {
                int count = queryResult.length;
                cpAssembler = new ComponentPresentationAssembler(22);
                for (int i = 0; i < count; i++) {
                    componentId = queryResult[i];
                    writer.print(cpAssembler.getContent(componentId, componentTemplateURI));
        } catch (Exception e) {
            throw new JspException(e.getMessage());
        return SKIP_BODY;

    public int doEndTag() throws JspException {
        return 0;

    public void release() {


The DWT code (PT) is below.(For the debug, the criteria is fixed value(2014).)

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="cd_tags" prefix="tridion" %>
<%@ taglib uri="cd_tags" prefix="news" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
    <news:NewsSearch criteria="2014" />

The DWT code (CT) is below.

  <th><img src="@@newsImage@@" alt="@@newsImageAlt@@" width="70" height="14" /></th>
    <td class="date">@@date@@</td>
       <li><a tridion:href="@@Component.ID@@">@@RenderComponentField("Fields.title",0)@@</a></li>

The output HTML is below.

<span><!-- Start Component Presentation: {"ComponentID" : "tcm:22-1226", "ComponentModified" : "2014-03-24T10:35:48", "ComponentTemplateID" : "tcm:22-1149-32", "ComponentTemplateModified" : "2014-03-19T13:21:02", "IsRepositoryPublished" : true } -->

  <th><img src="/ms/Images/press_icon.gif"  alt="press" width="70" height="14" /></th>
    <td class="date">2014年03月04日</td>

1 Answer 1


Most likely your Dynamic Component Template output type is set to HTML Fragment. This instructs Tridion to not do anything with the rendered output as it is plain static HTML.

Change your template output type to REL when storing DCPs in the database, or JSP Scripting if storing them on the filesystem.

enter image description here

  • >Dear Nickoli Roussakov. thank you to answer my question. I can solve the above problem by your solution. Thank you to help me.
    – Arai Yuhei
    Commented Mar 24, 2014 at 5:50
  • 1
    And the picture helps! Commented Mar 24, 2014 at 9:31

Your Answer

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

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