Java – Automatically include a JSP in every JSP

javajspwebsphere

I would like to simplify my JSP's even further by transparently including them. For instance, this is the line I would like to remove:

<%@ include file="/jsp/common/include.jsp"%>

The include.jsp file basically declares all the tag libraries I am using. I am running this on WebSphere 6.0.2 I believe and have already tried this configuration:

<!--    Include this for every JSP page so we can strip an extra line from the JSP  -->
    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.htm</url-pattern>
            <!--<include-prelude>/jsp/common/include.jsp</include-prelude>-->
            <include-coda>/jsp/common/include.jsp</include-coda>
        </jsp-property-group>
    </jsp-config>

Both the include-prelude and include-coda did not work.

I was reading that other WebSphere users were not able to get this up and running; however, tomcat users were able to.

Best Answer

The jsp-property-group was introduced in JSP 2.0 (i.o.w. Servlet 2.4). Websphere 6.0 is Servlet 2.3.

So you have 3 options:

  1. Forget it.
  2. Upgrade Websphere.
  3. Replace Websphere.