Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nesting EL functions

Tags:

java

jsp

jstl

el

I am getting EL parsing exceptions when doing this in my JSP:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page import="my.InternalConstants"%>

[...]

<c:set var="MYPREFIX"><%=InternalConstants.MYPREFIX%></c:set>

[...]

<c:forEach var="name" items="${data.names}" varStatus="status">
    <c:set var="reducedName" value="${fn:substring(name, fn:length(MYPREFIX), fn:length(name))}"/> <-- here is where the exception occurs

What am I doing wrong?

Thanks.

Update:

This is the exception:

view.jsp(86,94) --> JSPG0122E: Unable to parse EL function ${fn:substring(name, fn:length(MYPREFIX), fn:length(name)}).

at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateElFunction(ELValidator.java:500)
at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:122)
at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:149)
at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttribute(ValidateVisitor.java:1752)
at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttributeValues(ValidateVisitor.java:1400)
at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitCustomTagStart(ValidateVisitor.java:294)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:366)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:234)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:216)
at com.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:127)
like image 959
user751383 Avatar asked May 12 '11 21:05

user751383


People also ask

What is mean by nesting of functions?

A nested function is a function that is completely contained within a parent function. Any function in a program file can include a nested function.

Can functions be nested in Java?

Java does not support “directly” nested methods. Many functional programming languages support method within method. But you can achieve nested method functionality in Java 7 or older version by define local classes, class within method so this does compile.


1 Answers

If you have been using the WebSphere 8 your issue seems to be related with question:17744158

like image 117
JFC Avatar answered Sep 27 '22 17:09

JFC