Standard expression language question
Hi all. After executing the next two lines c:set var=foo1/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]
RE: Standard expression language question
It appears you are treating foo as a string. The + sign is concatenating 1 with 1 which gives you a result of a String containing the characters 1 and 1. Mark -Original Message- From: Pedro Diaz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 10:19 AM To: [EMAIL PROTECTED] Subject: Standard expression language question Hi all. After executing the next two lines c:set var=foo1/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]
Re: Standard expression language question
Thanks Mark. You are right. I don't want to concat, I want to add. Someone knows how to do it without scriptles? Greetings. Pedro. Mark Shead wrote: It appears you are treating foo as a string. The + sign is concatenating 1 with 1 which gives you a result of a String containing the characters 1 and 1. Mark -Original Message- From: Pedro Diaz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 10:19 AM To: [EMAIL PROTECTED] Subject: Standard expression language question Hi all. After executing the next two lines c:set var=foo1/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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Standard expression language question
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=foo1/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=foo1/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]