Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 61026 invoked from network); 19 Jun 2006 20:52:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jun 2006 20:52:15 -0000 Received: (qmail 29450 invoked by uid 500); 19 Jun 2006 20:52:09 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 29395 invoked by uid 500); 19 Jun 2006 20:52:09 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 29384 invoked by uid 99); 19 Jun 2006 20:52:09 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 13:52:09 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of rahul.akolkar@gmail.com designates 64.233.166.183 as permitted sender) Received: from [64.233.166.183] (HELO py-out-1112.google.com) (64.233.166.183) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 13:52:07 -0700 Received: by py-out-1112.google.com with SMTP id e30so1382308pya for ; Mon, 19 Jun 2006 13:51:47 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=m1fiuPzFYJ9gbu0xZ6RVPqsgPuI3LtwGw052rwUUfRUuq5Cx7PPHdQC3uBzda8dfQb+hDKQbQHnfSlyQXBOgGFR/kb90nrEBDjB6WP5ElpW+AcV4YM1kKPBt+eadzoNuuM4E5nNuYE8ikxhNf4KxQfqwh+oBBAuXu+pcNUxgCq4= Received: by 10.35.84.16 with SMTP id m16mr3278228pyl; Mon, 19 Jun 2006 13:51:47 -0700 (PDT) Received: by 10.35.68.5 with HTTP; Mon, 19 Jun 2006 13:51:47 -0700 (PDT) Message-ID: Date: Mon, 19 Jun 2006 16:51:47 -0400 From: "Rahul Akolkar" To: "Jakarta Commons Users List" Subject: Re: [jexl] EL-style string evaluations In-Reply-To: <7b809eef0606190925j131156aah3d35758059d6764d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7b809eef0606190925j131156aah3d35758059d6764d@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 6/19/06, Hubert Rabago wrote: > Is the sample in this message valid: > http://marc.theaimsgroup.com/?l=jakarta-commons-user&m=111974074105369&w=2 > No, its not. > SomeObject thingy = new SomeObject(); > thingy.setFoo( "Blah" ); > > String expr = > "JEXL let's you do everything you'd do with EL. ${thingy.foo}"; > Two issues about parsing that: * Single quotes demarcate String literals, and cannot be used at will like that * JEXL has no concept of ${...} and will not attach any semantics to the construct I suspect you can try: String expr = " ' JEXL lets you do everything you would do with EL. ' + thingy.foo " for the desired outcome (whitespace exaggerated for readability in email). -Rahul > Expression e = ExpressionFactory.createExpression( expr ); > JexlContext jc = JexlHelper.createContext( ); > jc.getVars( ).put("thingy", thingy); > String message = (String) e.evaluate(jc); > > I need this functionality in my app. I tried out the code above but got this: > > org.apache.commons.jexl.parser.ParseException: Encountered "let" at > line 1, column 6. > Was expecting one of: > "||" ... > ... etc ... > at org.apache.commons.jexl.parser.Parser.generateParseException(Parser.java:3274) > ... etc ... > > What's the proper way of evaluating "expr" in the sample above using JEXL? > > thanks, > Hubert > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org