I'm just evaluating Velocity expressions. The result of the expression should be an object, whereas Velocity.evaluate() renders output to a Writer as text. The method I'm looking for would look something like this:

public Object evaluate(Context ctx, String expression);

For example:

ctx.put("now", Calendar.getInstance());
TimeZone tz = (TimeZone)evaluate(ctx, "now.timeZone");

The Introspector seems to be much, much lower level than this.

Thanks,
Jeff

Will Glass-Husain wrote:
Not sure I get it.  Are you making a new expression language or just
evaluating Velocity expressions?

The introspector is what resolves objects and methods in Velocity.

WILL

On 8/19/06, Jeff Schnitzer <[EMAIL PROTECTED]> wrote:
Velocity.evaluate() renders textual output to a Writer.  For the
expression language to work, I need to resolve objects.  I can't find
anything in the javadocs that might give me a hook.

Any suggestions?

I know, I need to wade through the code, but a few starting pointers
would help.

Thanks,
Jeff


Will Glass-Husain wrote:
> Wow!  As a both a Velocity enthusiast and JSTL junkie that sounds like
> a really useful tag.
>
> It doesn't sound that hard to me.  Extract the expression, call
> Velocity.evaluate, and set the request attribute.  I guess you'd have
> to set up the context with all the beans first.
>
> WILL
>
>
> On 8/17/06, Jeff Schnitzer <[EMAIL PROTECTED]> wrote:
>> Short version: I wish for a JSP custom tag that will effectively let me
>> use Velocity expressions instead of the anemic JSTL expressions.
>>
>> Long version:
>>
>> Velocity already has a custom JSP tag that lets me do this:
>>
>> <vel:velocity>
>>     #if(true) cool velocity stuff #end
>> </vel:velocity>
>>
>> However, what I really really want is something that lets me use
>> velocity expressions the way I would use JSTL expressions.  The most
>> important is this:
>>
>> <vel:set var="foo" value="${cool.velocity(syntax)}" />
>>
>> The inability of JSTL expressions to call arbitrary java methods results
>> in muchhacking and hair pulling.  Velocity expressions rock.  I want
>> them :-)
>>
>> How hard would it be to make a <vel:set> tag? I looked around the APIs
>> but couldn't find anything helpful.
>>
>> Thanks,
>> Jeff
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>


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






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

Reply via email to