Page directives in a JSP affects the overall structure of the generated servlet. When a JSP is included statically (using <%@ include%>) within another JSP, would the called JSP's page directives gets precedence over calling JSPs page directives in the resulting servlet?

Serge Knystautas

When you statically include one JSP within another, you are effectively creating a single longer JSP that will be compiled as a whole. In effect with respect to page directives, a static include is the same as if you had cut and paste the included JSP into the original JSP.

According to the JSP 1.1 specification, in section 2.7.1, multiple directives are cumulative. (Re)definitions of an attribute/value should result in a fatal translation error.

In practice, some commercial JSP compiler engines might not comply with the letter of this law. Tomcat 3.1 is the reference implementation and will throw a compile error if you define an attribute multiple times in a given page.