jsp ${pageContext.request.contextPath} dosent get requested

前端 未结 2 492
遥遥无期
遥遥无期 2021-01-25 06:51

Currently i have a .jsp project where my welcome page is a servlet

frontpage

The servlet sets gets two

相关标签:
2条回答
  • 2021-01-25 07:40

    This is not the way to include stuff. Use jsp:include action to include the header/footer. If for some reason you really want to do it in the servlet, see this post. As long as you just grab a resource like you do, you're reading the file like any text, there is no JSP compilation/evaluation.

    0 讨论(0)
  • 2021-01-25 07:58

    add <%@ page isELIgnored="false" %> in top of your JSP page, to enable expression language.

    and to include a JSP page with other use <jsp:include like:

    <jsp:include page="/includes/nav.jsp"/>
    <jsp:include page="/includes/footer.jsp"/>
    
    0 讨论(0)
提交回复
热议问题