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"%>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s