... <%@include file="b.jsp"%> ... The file b.jsp accesses t" /> ... <%@include file="b.jsp"%> ... The file b.jsp accesses t" /> ... <%@include file="b.jsp"%> ... The file b.jsp accesses t"/>

JSP include variable passing

102 views Asked by At

Let's say I have a file called a.jsp which includes another file:

<%
String a = "Test";
%>
...
<%@include file="b.jsp"%>
...

The file b.jsp accesses the variable from the file it gets included from:

...
<%= a %>
...

If a.jsp gets called everything works fine and the string gets printed even though it was declared in another file.

Nevertheless b.jsp can't be called by itself and the syntax highlighting marks the reference to a as an error because the variable a is not present in in this file.

So my question is: Is there some way to 'import' another JSP file or to allow a file only to be included by a specific other file?

0

There are 0 answers