Hi Pedro,

The answer will depend on the final expression language.  For now, the
behavior you note is caused by the experimental 'ECMAScript' expression
language included with EA3; it performs concatenation on values it sees 
as Strings.  In this experimental language, you can work around the
problem by explicitly parsing values as numeric, as follows:

     <c:set var="foo">1</c:set>
     <c:set var="foo" value="$1 + parseInt(foo)"/>
     <c:expr value="$foo"/>

This will print "2".

(By the way, a note of caution is in order:  all of EA3 is experimental
and subject to change in the upcoming, final standard.  Don't get too used
to clever tricks and workarounds that are EA3-specific!)

--
Shawn Bayern
JSTL reference-implementation lead
Author, "JSP Standard Tag Library" (Manning,upcoming)   http://jstlbook.com

On Mon, 28 Jan 2002, Pedro Diaz wrote:

> Hi all.
> 
> After executing the next two lines
> 
>     <c:set var="foo">1</c:set>
>     <c:set var="foo" value="$foo + 1"/>
> 
> the value of foo is "11"
> 
> Is there a way to get that the value of  foo be 2 using expression
> language?
> 
> Thanks in advance.
> Pedro.
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to