When I call it from main.jsp
, test
is printed out as expected:
<%@ tag language="java" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
jspContext.setAttribute("test", "test");
%>
<c:out value="${test}"/>
But if I remove the last line and instead try to print the value of test
from main.jsp
, it doesn't work:
<c:out value="${test}"/>
Why can I not access the test
variable from the enclosing page but it is accessible from inside the JSP tag file?