jsp include doesn't work for jspf files under tomcat 8 but works under the jetty

橙三吉。 提交于 2019-12-13 01:12:25

问题


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>


来源:https://stackoverflow.com/questions/29964247/jsp-include-doesnt-work-for-jspf-files-under-tomcat-8-but-works-under-the-jetty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!