Customizing the included content with <jsp:param>
OK, so you’ve got a header that’s supposed to appear the same way on every page. But what if you want to customize part of the header? What if you want, say, a context-sensitive subtitle that’s part of the header, but that changes depending on the page?
You have a couple options.
The dumb way: put the subtitle information into the main page, as, say, the first thing in your page after the include for the header.
The smarter way: pass the subtitle information as a new request parameter to the included page!
Why that’s cool: if the subtitle information is supposed to be part of the header, but it’s a part that changes, you still want the header part of the template to make the decision about how that subtitle should appear in the final page. In other words, let the person who designed the header decide how the subtitle should be rendered!
JSP that does the include
The included header that USES the new param (“Header.jsp”)
Note: this idea of params doesn’t make any sense with the include directive (which is not dynamic), so it applies ONLY to the <jsp:include> standard action.