on 08-13-2008 3:43 AM
There is a problem with JSTL EL Expressions with function calls.
Problem 1: If the function that returns a boolean is preceded by "!" then an exception is raised at runtime.
Ex. <c:if test="${!r:isReady()}">
Problem 2: If the EL expression with a function call is NOT preceded by double-quotes or space then an exception is raised at runtime.
Ex. <c:set var="ab" value="$/$/" />
The above example the second EL expression is preceded by "/".
Does anyone know if these are known problems and/or if there are fixes?
Hi Enrique,
Can you post the JSP page here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for replying.
I will post a sample JSP but first allow me to refine the description of the problems. There are two issues.
Issue 1: related to "c:if" tag and the value parameter of this tag has an EL expression with a tag-function.
Case 1: the EL expression has a "!" as a first character and no space following it, and the "!" is involved in a tag-function.
Example: <c:if value="${!r:isReady()}" />
Case 2: the EL expression has a "!" and it is not the first character, and the "! is involved in a tag-function.
Example: <c:if value="${isInitialized && !r:isReady()}" />
Issue 2: related to "c:set" tag and the value parameter of this tag has an EL expression with a tag-function. The EL expression cannot be preceded by other characters.
Example: <c:set var="a" value="abcd$" />
Example: <c:set var="b" value="$" />
Sample jsp which has both issues:
<%@page session="false" contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="r" uri="http://www.dummy.com/rumba"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<html>
<head>
<title>$ ($)</title> <link href="${pageContext.request.contextPath}/css" rel="stylesheet" type="text/css"/> </head> <body> <jsp:include page="/www/common/header.jsp" /> <c:set var="msurl" value="$/$/$" />
<h2>
URL: $
</h2>
<div>
<b><fmt:message key="map.sr" />: </b> <tags:spatialReference value="${msi.spatialReference}" f="html" /> <br/><br/>
<c:if test="${!r:tokenBasedSecurity(pageContext.servletContext)}">
<b><fmt:message key="catalog.view-footprints-in" />:</b>
<a href="$$?f=kmz"><fmt:message key="catalog.ge" /></a>
<br/><br/>
</c:if>
</div>
</body>
</html>
This is excerp from the Expression Language Specification Version 2.1
1.14 ReservedWords
The following words are reserved for the language and must not be used as
identifiers.
and eq gt true instanceof
or ne le false empty
not lt ge null div mod
You're right that without space should be supproted...maybe in some next relaeases will be fixed...
I've just suggested workaround for you
Bets Regards
Bojidar
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.