I have to replace all internal links inside a rich text field with their respective jsp page reference For Example

<a title=" enjoy  the life  in your way " href="tcm:71-72624"> enjoy  the life  in your way</a>

Should be replaced by

<jsp:include page="/na/_scriptlets/RichTextLinks.jsp">
   <jsp:param name="title" value=" enjoy  the life  in your way" />
   <jsp:param name="tcmid" value="tcm:71-72624" />
   <jsp:param name="publicationName" value="na" />

Is this possible using the Tridion APIs? If yes , how it is possible ?

We are not using XSLT templating application.

One of my team members is assigned to write content delivery code inside the “RichTextLinks.jsp” which can resolve these internal links inside the richtext field of the Broker published Components and output the respective page’s URL.

Again here I would like to validate this whole approach? is it possible or not?

If there is some other best practice to deal such functionality please share with us.

  • This doesn't make any sense, as Will says. If you want to generate a JSP link, Tridion will do it for you (by default the links in RTF will be converted to a <tridion:ComponentLink> tag, can be changed to use inline JSP instead).
    – Nuno Linhares
    Oct 11, 2013 at 20:19
  • Looking at your example link, it seems like you're not using the Link Resolver Template building block in Tridion to convert the link to a "TCDL" link. If you add this TBB to your Tridion template, the links will be converted to JSP (if that's the language defined in your publication target)
    – Nuno Linhares
    Oct 11, 2013 at 20:24
  • Thanks Nuno for your interest on this question. Actually we are working on already implemented application in which News component is published to broker database and this new component have a summary field of type rich text. There is some already written API code which Returns XML of this component's content and we are applying XSLT on this XML to display the content.
    – user584
    Oct 14, 2013 at 6:46
  • Now, the above mentioned approach we are trying to resolve the internal links placed in the rich text field named "Summary". I do'nt know this approch is fit for this or not please suggest and correct me .
    – user584
    Oct 14, 2013 at 6:48
  • As long as the item is published on a Tridion page Tridion (Dynamic) Component Links will work for this setup. If these links are always from a "summary" component presentation (CP) to the "full" or "detail" version, you could template the link to however you handle detail pages. This probably doesn't apply if authors add the links in the RTF and might link to other CPs. Oct 15, 2013 at 19:02

2 Answers 2


It sounds to me like you are trying to rewrite functionality which already exists in Tridion, namely dynamic linking. If you use the Default Finish Actions TBB your published page or component presentation output will contain TCDL tags, which on deployment get transformed into JSP code for the standard Tridion dynamic linking taglib (which does exactly what you want - transforms the uri into the published URL for the component). Is there some reason why you are not using this standard functionality?

  • I don't understand how using dynamic linking will do the same functionality as including a JSP? Am I missing context?
    – Nuno Linhares
    Oct 11, 2013 at 16:02
  • The questions states that the included JSP will resolve the link into URL - this is exactly what the ComponentLink tag will do
    – Will Price
    Oct 11, 2013 at 18:29
  • Oh, I missed that part - obsessed about output.
    – Nuno Linhares
    Oct 11, 2013 at 20:18

You should create a .NET Template Building Block that is executed at the end of your compound template, this TBB should parse the Output with a Regular Expression to get Matches for all the links you want to replace, after you do it, you will need to replace the Matches with the JSTL tags you need generating a new Output item.

  • No. Even if you wanted/needed to re-write functionality that Tridion ships as standard (see Will's answer), why would you use regexes to find links in XML? Oct 11, 2013 at 14:40
  • 2
    @DominicCronin Because the Output item can be XML, but also quite often is plain text (which most of the time you can load into a DOM Document of course). Oct 11, 2013 at 14:45
  • 1
    @BartKoopman Then don't parse the Output but rather the input, in other words the Component.
    – Quirijn
    Oct 11, 2013 at 15:40
  • @Quirijn I agree, but that is not what Eric is mentioning in his answer ;) Oct 11, 2013 at 15:57
  • I wasn't aware we can replace <a href="TcmUri"></a> into <jsp:include><jsp:param /></jsp:include> out of the box. In my answer I am assuming that the Output (Package Item) is a string (XML, Text, Html) then it can be parsed by a RegExp to convert the <a> tag into <jsp:include>
    – Eric Huiza
    Oct 11, 2013 at 16:00

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.