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

19,985

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.

Share:
19,985

Related videos on Youtube

wsams
Author by

wsams

Hello, I'm a software engineer experienced in a variety of languages and tools. Most of my career has been spent in full-stack development. My favorite languages are Java, Python, JavaScript, Haskell, BASH, and PHP, but I tinker with anything I get my hands on. I enjoy the full life cycle of application development and I'm experienced deploying on bare metal and Docker environments. I'm also comfortable deploying applications into a Kubernetes environment, managing Linux systems, and all manner of scripting.

Updated on April 16, 2022

Comments

  • wsams
    wsams about 2 years

    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".

  • Julien Kronegg
    Julien Kronegg almost 11 years
    Disabling the whole validation is the short answer. For the long answer and alternatives, have a look to stackoverflow.com/questions/16593952/…
  • Markus L
    Markus L about 7 years
    Any specific instructions what to disable? I tried to set all Error to Ignore but the errors persist (even after re-validation). I'm using Eclipse Neon.2.