header and footer file in jsp for spring mvc

inside your view folder, you can create a template folder to hold your generic template files. Then create 2 files, header.jsp and footer.jsp. Write your header and footer codes inside those files.

In the view file ( in my case, it is home.jsp) include your template files like following,

<%@ include file="/WEB-INF/views/templates/header.jsp"%>
<%@ include file="/WEB-INF/views/templates/footer.jsp"%>
Advertisements

#jsp, #spring-mvc, #templates