In your master layout (or page layout), you should use the DD4T method to render dynamic component presentation rather than a JSP include. 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][1]


  [1]: https://github.com/dd4t/dynamic-delivery-4-tridion/blob/master/java/dd4t-core/src/main/java/org/dd4t/contentmodel/impl/ComponentPresentationImpl.java