“someVariable不能解决”包含的JSP在Eclipse中显示错误 [英] "someVariable cannot be resolved" error indicated in Eclipse for an included JSP
问题描述
<%@ include file =/ WEB-INF / views / includes / jstl / include.jsp %GT;
<%@ 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%>
include.jsp包含一个字符串String basePath = request.getContextPath();。
navbar.jsp使用basePath,但Eclipse在使用basePath的任何navbar.jsp行上放置一个红色的X,消息为basePath不能解决。
我的webapp工作得很好,但是想知道可能导致什么,还是可以解决?或者也许有一种方法让Eclipse忽略这个?我只是想要虚假的红色X的消失。我想Eclipse不明白navbar.jsp从include.jsp获得basePath,因为它与index.jsp一起编译。
Eclipse是一个史诗故障关于JSP / EL验证。只需忽略它,或通过验证和/或 Web > JSP文件> 禁用工作区首选项中的所有(或部分)JSP / EL验证em>验证。
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".
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.
这篇关于“someVariable不能解决”包含的JSP在Eclipse中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!