Darin Wilson wrote:
>
> Using the include directive (as you are doing) rather than the include
> action (<jsp:include ...>) means that the file is "included" at page
> translation time rather than page request time; your included file is
> essentially cut and pasted into the calling JSP *before* the page is
> compiled. So, you don't actually need to pass parameters into the included
> .jsp - they'll just be there as part of the resulting servlet's method.
Yup, I've been using the include directive for quite a while, for
breaking out applications into components. the problem, when you do
that, is that it becomes unamanagable very easily, because of the lack
of static checking. when you start having a lot of small jsp files (I
call them .jsc for Java Server Components - it is chunks of jsp files
that cannot be used as standalone pages), it is very difficult to keep
track of who's using what. if one JSC is used by 10 other JSC, and you
need one more external variable in your JSC, it's very difficult to go
update every other component, plus you have to be very careful with the
name of the "parameters" (which are actually more like global variables
- reminds me of the old days of dynamically scoped languages).
Ideally, what I would like is to be able to package these components
into a standalone component, that can be statically checked; something
like:
header.jsc:
<%some kind of directive to say "this is a component, not a page"%>
<%param String title>
<HTML>
<HEAD>
<TITLE><%=title%></TITLE>
...
</HEAD>
and then in page.jsp, I'd do:
<BLAH>
<%include component=header.jsc "this is the title"%>
This could be resolved at compile time (I don't want any runtime
overhead) into java method calls (very approximate description):
// header.jsc
void _jsp_header(JSPWriter out, String title) {
out.write("<HTML>
...
}
//_jspService(...) {
out.write("<BLAH>");
_jsp_header(out, "this is the title");
...
}
then I would have fully types JSP components; and I would be soooo
happy.
any idea, how I could get close to that (hacks accepted) ?
jm.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html