I have a servlet that sets a request attribute named "snippet" and forwards to a JSP page. The JSP page has a runtime include as follows:
<jsp:include page="/WEB-INF/jsp/snippets/${snippet}.jsp/>
I also have the following defined:
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude>/WEB-INF/jsp/top.jsp</include-prelude>
<include-coda>/WEB-INF/jsp/bottom.jsp</include-coda>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
<default-content-type>text/html</default-content-type>
</jsp-property-group>
I think what is happening is when the <jsp:include>
triggers, the container also applies the <include-prelude>
and <include-coda>
configurations because I am seeing some wierd nested HTML code in my response.
Question is, is it possible <include-prelude>
and <include-coda>
is applied when using <jsp:include>
? If so, how can I get around this?
Thanks!
As given How to load particular page without JSP include prelude and coda , the answer seems to be to create a separate property group.
I suggest putting them in a sub-directory.
<jsp-property-group>
<url-pattern>/includes/*</url-pattern>
</jsp-property-group>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.