Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 JSP 标记中有一些 EL 代码。该行开始如下:
<c:if test="${pageContext.request.serverName eq \'localhost\'}">
Eclipse 对此抛出了一个错误,说:
由于词法分析错误,无法分析 EL 表达式
我不确定这甚至意味着什么。这是一个日食错误吗?我是否错误地混合了 EL 和 JSTL 标签?
只需不带反斜杠即可:
${pageContext.request.serverName eq 'localhost'}
带有该代码的 JSP:
${pageContext.request.serverName eq 'localhost'} <c:if test="${pageContext.request.serverName eq 'localhost'}">faith</c:if>
为我呈现“真正的信仰”。"${pageContext.request.serverName}" 显示什么?