A.G.
A.G.

Reputation: 21

Tomcat 9.0.67 <%@ include dont work in some cases

We update our system to the newest tomcat 9-Version now some jsp throws exception like:

Caused by: org.apache.jasper.JasperException: /WEB-INF/views/manager/content/content.jsp (Line: [653], Column: [5]) File [include/editConten.jsp] not found

At line 653 we have the following code:

<%@ include file="include/content.jsp"%>

The content-jsp exists and if I change to:

<jsp:include page="include/content.jsp"/>

It works but can't access the models.

Other jsps with the same include works fine, also with Tomcat 9.0.64 all worked fine.

Somebody knows any changes to fix this or is this a bug of the newest tomcat 9?

Note: This seems to happen if you have multiple relative includes.

Upvotes: 0

Views: 694

Answers (2)

user10095279
user10095279

Reputation: 41

Posting example code snippet if anybody get confused by the wording "if you link all absolute it works fine." of solution post.

Example code snippet : Before JSP changes

<%@ include file="your_jsp_file.jsp"%>

After JSP changes

<%@ include file="./../your_jsp_file.jsp"%>

So basically you need give relative path from main file, because it seems like it goes from relative to relative, not from main file.

This will just give an idea about term "absolute" which was in actual answer post.

Upvotes: 0

A.G.
A.G.

Reputation: 21

I found a solution, this happens only if you use multiple relative includes in the same jsp. If you link all absolute it works fine. It seems that the system goes relative from the relative include not from the main file.

So if anybody has the same problem and multiple includes link all absolute not relative

Edit: Is a bug of tomcat and fixed with the next version

Upvotes: 2

Related Questions