commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Ross" <>
Subject RE: [jelly] Control of expression execution for an attribute
Date Tue, 18 Mar 2003 15:36:30 GMT
Thanks James,

I've been looking specifically how to accomplish this, and I must say,
nice work :)  Jelly seems to allow me to do this at different stages,


This kind of forethought exemplifies a well built tool.  

I think I'll shoot for the Tag.set...(Expression) because it will be a
fairly isolated incident.

Thanks again,

Kevin Ross

-----Original Message-----
From: James Strachan [] 
Sent: Tuesday, March 18, 2003 9:07 AM
To: Jakarta Commons Users List
Subject: Re: [jelly] Control of expression execution for an attribute

 From: "Kevin Ross" <>
> I am looking to try and support multiple different expressions for a
> single attribute.  I hope to inspect the expression at runtime,
> determine what type it is with some sort of certainty, and execute the
> appropriate expression type.
> Once the tag is called (setter or invoke), is there any way for me to
> access the original expression for that attribute, so I can custom
> process with jexl or xpath or . etc.?

You could process multiple expressions first then pass the result into


<j:set var="temp" value="..."/>
<j:if test="${something == 'abc'}">
    <j:set var="temp" value="bar"/>

<foo a=${temp}"/>

If you want a Tag to process the Expression in some way you could
your setter method as being of type Expression...

public class FooTag {
    private Expression exp;

    public void setA(Expression exp) {
        this.exp = exp;

    public void doTag(XMLOutput  out) {
        Object result = exp.evaluate(context);

then you'd get access to the Expression object and it will not be
by default - then its up to your tag to evaluate the expression however

Note that the intention is for the Expression object to be read only (so
can be cached) but that you can evaluate it, with whatever context you
however many times you like.


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message