jsp include doesn't work for jspf files under

2019-08-09 19:26发布

问题:

I have the following jsp:

...
<jsp:include page="../imageMenu.jspf"/>
...

When I open following jsp when application run under the tomcat 8 I see that my include replaces with empty string.

When I run application under the jetty - it renders good.

As I undestand the problem related with format of included file because I don't see problem with jsp files included when I run application under the tomcat.

回答1:

Working after adding

<url-pattern>*.jspf</url-pattern>

to web.xml

result:

<servlet-mapping>
        <servlet-name>servletname</servlet-name>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jspx</url-pattern>
        <url-pattern>*.jspf</url-pattern>
    </servlet-mapping>


回答2:

Can you try using full path.

<jsp:include page="/WEB-INF/JSPs/repo1/repo2/imageMenu.jspf"></jsp:include>