In your master layout (or page layout), you should use the DD4T method to render dynamic component presentation (that's what we use in our c# based razor views and assuming you should be able to do the same in Java as well). This is assuming you have created Header, footer etc as dynamic components since they are included on multiple pages and you don't want to republish all pages when you make changes to your component. Here is the DD4T Java implementation link where you can find methods to use: DD4T Java GitHub