3

I would like to render my pages in the browser using a JavaScript framework like React. So far, all our Tridion content is rendered as HTML on the serverside using JSP.
I can imagine it is possible to let Java render JSON objects instead of full HTML. But what I'm hoping is that the data is already available in the JSON format, so I can just access that. Ideally it should be structured so that I can request a normal page, and get the whole hierarchy of modules and their copy and media manager urls for images.
I'm trying to find out if DD4T does something like this, but I might be on the wrong track if it's not possible in the first place.

6

At the moment I imagine that your current implementation is "baking" your HTML during publishing and including some JSP code which is executed on the server.

There's nothing to stop you from having your templates render pages as JSON data and serving those up to React. DD4T could certainly help you here, as the publishing side already serialises to JSON, though you may want to shrink the data to only that which you need in your React app and to omit any sensitive information.

  • Thanks David, yes that is indeed what we are doing, publishing static html. Ideally, I'd like not having to create JSP code for all pages, but just get a certain 'node' from the Tridion content tree, based on a GUID for example. But good point that filtering the data might be needed in some cases. Have you tried something like this yourself? – Micros Apr 13 '17 at 15:58
  • 1
    I know of a customer who's serving up DD4T JSON to their React based front-end. Their web application basically retrieves the JSON data as pages from the content delivery API by the requested URL. – David Forster Apr 13 '17 at 16:01
  • 1
    bcg.com - also worth looking into DXA 2.0 Technology Preview, the model service might be exactly what you're looking for: github.com/sdl/dxa-web-application-java/releases – Nuno Linhares Apr 13 '17 at 16:18
  • 2
    I will have to add that the DXA Model Service is not intended as public API (yet), but a DXA Web Application (1.x or 2.0) can also serve JSON. – Rick Pannekoek Apr 14 '17 at 12:08

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.