we are using Tridion 2009 SP1. Our webserver is a Weblogic.

We have content published with some taxonomies.

For showing the results we determine the tcm of the content using taxonomies.

When we have the list of tcm's, then we try to get the component presentation but sometimes we have the content published with his taxonomies but we don't have the component presentation published that we need.

We try to determine if the component presentation is published using the next sentences:

bool hasPres = false;
ComponentPresentationAssembler cpa = tagVals.getCpa();
String contentImage = cpa.getContent(compId, tagVals.getPresId());
if(!contentImage.isEmpty()) hasPres = true;

But we use cpa.getContent() we are writing the presentation to the page.

is there any method to validate that the component presentation is published?

Thank you.



1 Answer 1


Instead of using the ComponentPresentationAssembler, you could use the ComponentPresentationFactory to determine this. It's getComponentPresentation method will return a ComponentPresentation object that is null in the case of no CP existing

For example:

bool hasPres = false;

// add a method to get the CPF to your tagVals class
ComponentPresentationFactory cpf = tagVals.getCpf();

CompponentPresentation cp = cpf.getComponentPresentation(compId, tagVals.getPresId());

// test to see if the ComponentPresentation exists
if (cp != null) {
    hasPres = true;

    // You can use the getContent method of the actual ComponentPresentation to
    // get the content here if you wish
    String contentImage = cp.getContent(true);

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.