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 ?

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

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, privacy policy and cookie policy

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