Includes and imports can be messy

Using <jsp:include> or <c:import> lets you add reusable chunks of content, dynamically, to your pages. And you can even customize how the included file behaves by setting new request parameters that the included file can use.
Sure, it works fine. But should you really have to create new request parameters just to give the included file some customizing information?
Aren’t request parameters supposed to represent form data sent from the client as part of the request? While there might be good reasons to add or change request parameters in your app, using them to send something to the included file isn’t the cleanest approach.
Until JSP 2.0, there wasn’t a standard way to deploy included files—you could put the included pieces just about anywhere in the web app. And a JSP with a bunch of <jsp:include> or <c:import> tags isn’t the easiest thing to read. Wouldn’t it be better if the tag itself told you something about the thing being included? Wouldn’t it be nice to say something like:
<x:logoHeader> or <x:navBar>
You know where this is going...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access