Jsp: enable not work with expression language (JSP version 2.5, EL enabled)

I read: The expression language in JSP does not work, but it is slightly different.

Using EL to link to a file works fine, as shown below.

   <link rel="stylesheet" type="text/css" 
href="${pageContext.request.contextPath}/css/global.css"/>

However, when trying to use the JSP include tag with an EL expression:

<jsp:include page="${pageContext.request.contextPath}/header.jsp" />

This returns http 500.

org.apache.jasper.JasperException: javax.servlet.ServletException: File &quot;/head_first/header.jsp&quot; not found
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:527)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

I also included EL as well.

<%@ page isELIgnored ="false" %>

My version of tomcat 6.0 and web.xml determines that JSP is 2.5

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

Does anyone know why EL doesn't work ONLY when used in jsp: include tag?

+3
source share
1 answer

EL . . jsp:include page . . . /head_first/head_first/include.jsp, , , .

+6

Source: https://habr.com/ru/post/1759993/


All Articles