You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Juan Dellarroquelle <ra...@usa.net> on 2002/07/15 16:17:12 UTC

Parsing behavior question

Hello,

Let's say that I have an object in the context "foo" that exposes a method
"getText()"
and I'm using it inside a Velocity template like this:

$foo.getText()

If I had another String object in the Velocity context called "fooStr" and
the
getText() method would return a string like: "This is just a ${fooStr}
sample text",
Would velocity parse the ${fooStr} inside the returned string by
$foo.getText() ?

Thanks in advance,

Juan.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Parsing behavior question

Posted by Juan Dellarroquelle <ra...@usa.net>.
Hey! Two in one!
Thanks for the quick answer.

Juan.

----- Original Message -----
From: "Geir Magnusson Jr." <ge...@adeptra.com>
To: <ve...@jakarta.apache.org>
Sent: Monday, July 15, 2002 11:23 AM
Subject: Re: Parsing behavior question


> On 7/15/02 10:17 AM, "Juan Dellarroquelle" <ra...@usa.net> wrote:
>
> > Hello,
> >
> > Let's say that I have an object in the context "foo" that exposes a
method
> > "getText()"
> > and I'm using it inside a Velocity template like this:
> >
> > $foo.getText()
> >
> > If I had another String object in the Velocity context called "fooStr"
and
> > the
> > getText() method would return a string like: "This is just a ${fooStr}
> > sample text",
> > Would velocity parse the ${fooStr} inside the returned string by
> > $foo.getText() ?
>
> No.  velocity doesn't do anything to returned values.  I think that except
> for this case, you would never want that.
>
> Now, your next question will be "how do I do this then?" and the answer is
a
> tool that takes the string and renders it against the context.  You can do
> this using the Velocity.evaluate() methods.
>
> I owe a contribution of a tool (promised someone else), so I'll get off my
> kiester and do this.
>
>
> --
> Geir Magnusson Jr.
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Parsing behavior question

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/15/02 10:17 AM, "Juan Dellarroquelle" <ra...@usa.net> wrote:

> Hello,
> 
> Let's say that I have an object in the context "foo" that exposes a method
> "getText()"
> and I'm using it inside a Velocity template like this:
> 
> $foo.getText()
> 
> If I had another String object in the Velocity context called "fooStr" and
> the
> getText() method would return a string like: "This is just a ${fooStr}
> sample text",
> Would velocity parse the ${fooStr} inside the returned string by
> $foo.getText() ?

No.  velocity doesn't do anything to returned values.  I think that except
for this case, you would never want that.

Now, your next question will be "how do I do this then?" and the answer is a
tool that takes the string and renders it against the context.  You can do
this using the Velocity.evaluate() methods.

I owe a contribution of a tool (promised someone else), so I'll get off my
kiester and do this.


-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>