In the Spring MVC application project current I am working on, We have number of JSP files in our View tier. Within each we have a Html element containing properties like page title, keywords, stylesheet links, and etc.
As our JSP files are growing in quantity, I would like to avoid copying and pasting common parts in HTML head element such as title and meta informations. In addition page title and keywords meta may change in future and I am not planning to open each JSP file to propagate the change.
What I first came up with was to create a .properties file and use JSTL fmt:message tag in following manner:
<fmt:message key="villap.title" var="title" />
<fmt:message key="villap.keywords" var="keywords" />
<head>
<title>${title}</title>
<meta name="keywords" content="${keywords}"/>
</head>
Still I have to place this same code segment in each one of my JSP files.
What is the best practice here? Should I put the HTML head section all together in a separate JSP file and import it every time?