Yes, if you want to parameterize the included JSP at runtime, you have to do it the way you are doing it. However, you can also use a static include, and just use c:set with page scope before you include your header:

<jsp declaration>
<"c" taglib declaration>

<c:set var="title" scope="page" value="MyTitle"/>

<jsp:directive.include file="/shared/header.jsp"/>

(included page will have access to the page scoped variable)

<jsp:directive.include file="/shared/footer.jsp"/>

The only thing that stinks about it is you have to declare your "c" tag in the main page. If you weren't needing the c:set before you did the static include, you could just leave all your taglib declarations in the header. Alternatively, your included page could grab the page title from some attribute you set in a setup action. Then you don't need the parameter, and all your taglib declarations can live in the header.

I haven't found much use for the dynamic variety include. Probably whenI learn to use some template framework I'll forget about all this anyway.

Erik

Slattery, Tim - BLS wrote:

BTW, it seems like you should be using <%@ include %> or am I missing something?



Beats me. Clearly I don't understand the difference. The header.jsp page needs to have a parameter passed to it, and it looks like the <jsp:include..> syntax is the only way to do that.

--
Tim Slattery
[EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to