0

If I have a component id (for example tcm:9-123), is there a way to get its content? How can this be achieved in java ?

8
  • Is that components are DCP?
    – Velmurugan
    Commented Mar 12, 2018 at 12:06
  • No, not DCP. We have based it on dxa's webapp-java project
    – Rache
    Commented Mar 12, 2018 at 12:14
  • Did you mean, if we are using DCP model to assemble content from the Content Data Store, then yes.
    – Rache
    Commented Mar 12, 2018 at 12:33
  • AFAIK - Yes, with DCP you can able to get component MVCData
    – Velmurugan
    Commented Mar 12, 2018 at 12:52
  • Can you share some code, please, in java
    – Rache
    Commented Mar 12, 2018 at 13:18

1 Answer 1

3

In general, you can’t get the content of Components separately on the CD side.

You can get the content of a Dynamic Component Presentation, though. In DXA, DCPs are represented as Entity Models with an ID like <ComponentID>-<TemplateID>. For example: 123-234 for a DCP of Component tcm:x-123 rendered with Template tcm:x-234-32.

You can use ContentProvider.getEntityModel for this purpose.

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.