Bug 10933

Summary: '/' forced binaryOp conversion
Product: Taglibs Reporter: Serge Knystautas <sergek>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: minor    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: Other   
OS: All   

Description Serge Knystautas 2002-07-18 02:40:13 UTC
I'm trying to use the c:set tag to append a series of directories together, and
I'm finding that the '/' character in EL is being forced to a binary op and
won't get treated as a String.  You can see what I mean by doing the following:
<c:set var="foo" value="${'/' + '/'}" />.  I get the following exception:
javax.servlet.jsp.JspException: An error occurred while evaluating custom
action attribute "value" with value "${'/' + '/'}": An exception occured
trying to convert String "/" to type "java.lang.Long"
	at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:140)
	at org.apache.taglibs.standard.tag.el.core.SetTag.doStartTag(SetTag.java:95)

I don't see any way to escape this character in the spec, but this seems like
the implementation is aggressively trying to convert back to a binaryOp.  Not
sure how you would resolve this.
Comment 1 Shawn Bayern 2002-07-18 02:47:14 UTC
This is not a bug; the behavior is as specified.  The JSTL expression language 
does not support "+" as a string-concatenation operator.  Instead, use 
something like this:


That is, an attribute value can contain multiple expressions, so we 
intentionally did not provide a string-concatenation operator -- and thus 
avoided many of the confusions surrounding it that plague ECMAScript.