Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"someVariable cannot be resolved" error indicated in Eclipse for an included JSP

So I have a main JSP index page, "index.jsp", which has several includes. Something like,

<%@ include file="/WEB-INF/views/includes/jstl/include.jsp" %>
<%@ include file="/WEB-INF/views/includes/licenses/license.jsp" %>
<%@ include file="/WEB-INF/views/includes/generalHtml/header.jsp" %>
<%@ include file="/WEB-INF/views/includes/navigation/navbar.jsp" %>
<%@ include file="/WEB-INF/views/includes/generalHtml/footer.jsp" %>

The "include.jsp" contains a string "String basePath = request.getContextPath();".

"navbar.jsp" uses "basePath", but Eclipse puts a red X on any line of "navbar.jsp" that uses "basePath" with the message "basePath cannot be resolved".

My webapp works just fine, but wondering what might be causing this, or if it can be resolved? Or maybe there's a way to make Eclipse ignore this? I just want the false positive red X's to go away. I suppose Eclipse doesn't understand that "navbar.jsp" is getting "basePath" from "include.jsp" because it is compiled together with "index.jsp".

like image 297
wsams Avatar asked Feb 15 '10 18:02

wsams


1 Answers

Eclipse is an epic failure with regard to JSP/EL validation. Just ignore it or disable all (or parts of) JSP/EL validation in workspace preferences through Validation and/or Web > JSP Files > Validation.

like image 191
BalusC Avatar answered Sep 17 '22 21:09

BalusC