Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Re: JEXL With Conditionals in media.properties

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Re: JEXL With Conditionals in media.properties


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Colin Hudler <>, "" <>
  • Subject: RE: [grouper-users] Re: JEXL With Conditionals in media.properties
  • Date: Fri, 11 Jun 2010 13:16:22 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

I haven't really looked into it, but yes, if velocity has more marketshare
and does a better job, maybe it would have been a better choice. I picked EL
since JSP developers are familiar with it, and it seems like an easy and
intuitive way to make small scriptlets. JEXL unfortunately doesn't have the
high level API that you might expect to execute a JSP (text with scripts
inside), it just executes script fragments I think. So I wrote the below
code to find the scriptlets and execute them.

I didn't really expect complex scripts with curlies... whoops. Btw, Grouper
1.6 has jexl2...

Anyways, I think there are two possibilities here:

1. You could write a java method in a custom class to do what you want and
call that from the script (fully qualified, and I hope you can pass the
relevant objects you need)

2. I could write a better method below that finds the scriptlets (including
nested curlies) [not sure when this will get done]

Anyways, if you need help with #1 (I *think* it is possible), let me know

Thanks,
Chris

-----Original Message-----
From: Colin Hudler
[mailto:]

Sent: Friday, June 11, 2010 12:49 PM
To:

Subject: [grouper-users] Re: JEXL With Conditionals in media.properties

Replying to myself, but without a fix.. I see at least one potential
problem, in GrouperUiUtils.java substituteExpressionLangauge():

Pattern pattern = Pattern.compile("\\$\\{(.*?)\\}");

That pattern will stop at my first '}'. I don't see an easy work-around
at the moment.

On 06/10/2010 06:58 PM, Colin Hudler wrote:
> Hi,
>
> We use the LiteUI and it is great that some properties allow an
> embedded parser (is it JEXL?). I need to customize subject displays,
> so I am using the property:
>
> "grouperUi.subjectImg.screenEl.0"
>
> Unfortunately, it fails this simple test:
>
> ${if (true) { "hello"; }}
>
> The Add member box in LiteUI says:
>
> "Error searching for members: chudler, Error substituting string:
> '${if (true) { "hello"; }}'"
>
> Does it even support conditionals? Does anyone have a link to the
> syntax for the version grouper is shipping with?
>
> Would grouper-devs consider JEXL 2.0 at some point? It supports
> ternary operators and many other enhancements. However, it is not a
> drop-in replacement; Apparenlty, some API changes have occured. Yet a
> more active alternative is
> <http://velocity.apache.org/engine/index.html>.




Archive powered by MHonArc 2.6.16.

Top of Page