jsp:directive.include file= "blah.jsp" vs jsp:include page="blah.jsp" what gives?


in a .jsp page when I type:

<jsp:include page="header.jsp" />

I get the expected behavior. That is the text is colored to indicate no errors.

However, when I type:

<jsp:directive.include page="header.jsp" />


is colored red with the error message:

"invalid tag name" directive.include

Have I miss configured something? (The webapp runs and is debugging under both cases).

Thanks in advance for any clarification.


Comment actions Permalink

Please read the JSP manual. There is no jsp:directive.include.


Comment actions Permalink

I will double check the JSP spec, but my example comes from a JSP book. I thought the syntax looked incorrect though. It really is incorrect, I'd expect invalid pages to be generated. ...

Thanks for the reply though. I will investigate further.

Comment actions Permalink


Actually there is a jsp:directive.include as of JSP1.2., however it cannot be used in 'regular' JSP pages.
* JSP.2.1.2 XML Document for a JSP Page JSP pages have an equivalent XML document. The XML view of a JSP page is exposed to the translation phase (see below). A JSP page can be written directly as an XML document. Beginning with JSP 1.2, the XML document can be delivered to a JSP container for processing. It is not valid to mix standard syntax and XML syntax in the same source file. However, a JSP page in either syntax can include a JSP page in either syntax via a directive. ** ]]>
* JSP.5.2.4 The jsp:directive.include element The jsp:directive.include element is used to substitute text and/or code at JSP page translation-time. This element can appear anywhere within a JSP document. Its syntax is: The interpretation of a jsp:directive.include element is as in Section JSP.2.10.3. The XML view of a JSP page does not contain jsp:directive.include elements, rather the included file is expanded in-place. This is done to simplify validation. ** ]]>


PS. I've never used the XML syntax directly so I don't know if idea has any problems with it.

Comment actions Permalink

Your are right. There is "jsp:directive.include" for jsp documents (xml files). But it's not for jsp pages (html with jsp tags).

I think, Spencer was referring to jsp pages, because "jsp:include" worked.



Please sign in to leave a comment.