Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expression Language & Eclipse warning: "items" does not support runtime expressions

i have the following JSP:

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><c:out value="${it.title}"/></title>
    </head>
    <body>
        <c:forEach var="speaker" items="${it.speakers}" varStatus="stat">
            <ul>
                <li><c:out value="${speaker.person.firstName}" /> <c:out value="${speaker.person.lastName}" />, <c:out value="${speaker.person.address.city.zip}" /> <c:out value="${speaker.person.address.city.name}" /></li>
            </ul> 
        </c:forEach>
    </body>
</html>

Eclipse warns me about every instance of EL Expressions in my code:

Warning [line 10]: "value" does not support runtime expressions
Warning [line 13]: "items" does not support runtime expressions
...

this is however not true, EL gets evaluated correctly by the server.

Can anyone hint me in the right direction why eclipse is warning me about those EL expressions?

like image 933
fasseg Avatar asked Aug 20 '10 12:08

fasseg


People also ask

What is expression in language?

Expression is the act of putting thought into verbal form, which involves the encoding or creation of a text or utterance. The individual engages in language as both a speaker/listener and a writer/reader, and this engagement involves both acts of expression and communication.

What is the main purpose of expression language?

Expression language (EL) has been introduced in JSP 2.0. The main purpose of it to simplify the process of accessing data from bean properties and from implicit objects. EL includes arithmetic, relational and logical operators too.

What is common expression language?

Common Expression Language (CEL) is an open-source non-Turing complete language that implements common semantics for expression evaluation. Certificate Authority Service supports CEL to enforce various policy controls for certificate issuance.

Where is the expression language used?

This chapter introduces the Expression Language (also referred to as the EL), which provides an important mechanism for enabling the presentation layer (web pages) to communicate with the application logic (managed beans). The EL is used by both JavaServer Faces technology and JavaServer Pages (JSP) technology.


Video Answer


3 Answers

Your taglib directive imports a JSTL 1.0 taglib. It should be JSTL 1.1 instead (note the difference in URI):

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
like image 160
axtavt Avatar answered Oct 01 '22 23:10

axtavt


Possible solution (found here):

Twin Libraries

The JSTL tag libraries come in two versions which differ only in the way they support the use of runtime expressions for attribute values.

In the JSTL-RT tag library, expressions are specified in the page's scripting language. This is exactly how things currently work in current tag libraries.

In the JSTL-EL tag library, expressions are specified in the JSTL expression language. An expression is a String literal in the syntax of the EL.

When using the EL tag library you cannot pass a scripting language expression for the value of an attribute. This rule makes it possible to validate the syntax of an expression at translation time.

So maybe your eclipse and the server use different tag libraries.

like image 33
Andreas Dolk Avatar answered Sep 30 '22 23:09

Andreas Dolk


try this: change this:

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>

to yes:

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>

hope it works for you. I got this from www.csdn.net.

like image 33
Kurt_Zhu Avatar answered Sep 29 '22 23:09

Kurt_Zhu