Skip to main content
2 of 3
correctly formatting code block by indenting with four spaces
Bart Koopman
  • 29.6k
  • 3
  • 40
  • 90

DD4T with java using OData

I am using DD4T with java using odata web service. I am able to retrieve the content of whole page in java using odata. But I am not sure how can we get the values of individual elements to create the JSP pages. I have created Odata client and then used below code to retrieve content from odata:

String filter = String.format("PublicationId eq %d and Url eq '%s'", 176, "/example/test.html");

OEntity pageEntity1 = ODataClient.INSTANCE.getPageEntities().filter(filter).expand("PageContent").execute().firstOrNull();
        
OEntity pageContentEntity = pageEntity1.getLink("PageContent", OLink.class). getRelatedEntity();
        
System.out.println(pageContentEntity.getProperty("Content", String.class).getValue());

But this is giving content of whole page. I want content of individual field of component.

Please help...