I am not able to read field of component from page-template using dd4t,

I want to read component --> metadata --> embedded schema --> embedded field

<c:forEach var="componentPresentations" items="${pageModel.componentPresentations}" varStatus="status">
  <c:if test="${componentPresentations.componentTemplate.title == 'Component Template [4 Column]'}">
    <c:out value ="${componentPresentations.component.metadata[1].value.embeddedValues[0].content[0].key['key']}" />

I am just able to access component from line 3 given

<c:out value ="${componentPresentations.component}"/>

How do i access field of component from page?

Page --> component --> metadata --> embedded schema --> embedded field

1 Answer 1


I guess you need to target your component itself. as you are getting the component using 3rd line. try to check the tracings in IDE.

Also, when you loop through all the component presentation, try to get component from component presentation then convert to model. Do something like this:

public static <MethodName> findByPage(GenericPage page) throws ModelException {
    for (ComponentPresentation componentPresentation :   page.getComponentPresentations()) {
        GenericComponent component = componentPresentation.getComponent();
        if ("<rootElementName>".equals(component.getSchema().getRootElement())) {
            return (<PageName>) ModelFactory.createInstance(component);

    return null;
  • sorry for late reply, thanks for suggestion, i created method to read components from the page :) . Mar 17, 2016 at 8:07
  • Cool. Happy that you got solution. Mar 29, 2016 at 20:52

Your Answer

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

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