I think I must be missing this in the documentation somewhere.
I’ve read through https://www.onehippo.org/trails/deep-dive/hello-world.html and the GoGreen trails.
I have created Document Types and Documents based on them. If I want to display that content in a view do I have to create a custom Component (controller) every time?
I have and it works, but I’m wondering if it could be done with configuration instead?
So for every “page” that uses the custom Document Type I need to have a component with a method like:
@Override
public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException {
super.doBeforeRender(request, response);
final HstRequestContext ctx = request.getRequestContext();
// Retrieve the document based on the URL
HeroFrontSixCardDocument document = (HeroFrontSixCardDocument) ctx.getContentBean();
if (document != null) {
// Put the document on the request
request.setAttribute("document", document);
}
}
I don’t mind, I’m just wondering if I can configure this instead.
thanks and sorry if I missed this in the documentation.
John