You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Anthony La Forge <e_...@hotmail.com> on 2001/11/26 01:35:37 UTC

Re: Finding/Getting list of the variables fro... (Solution)

As I said in the previous e-mail, thanks again to everyone who responded.  Based on your suggestions to use a pull based system I finally figured out how to accomplish basically the tasks I needed to perform.  It took me a little bit to figure it out, but then it dawned on me.  

Create a new class and override the toString() function, placing any necessary function calls in there, and then put it with the associated keyword in the template.  That way the function calls are not utilized until they are required at the time of render.  

Thanks again for the input.

Regards,

AGL

Re: Finding/Getting list of the variables fro... (Solution)

Posted by Joshua Levy <jo...@yahoo.com>.
--- Anthony La Forge <e_...@hotmail.com> wrote:
> Create a new class and override the toString() function, placing any
> necessary function calls in there, and then put it with the
> associated keyword in the template.  

I'm sure that will work great for you, but I was kind of hoping
for a 'real' solution.  I'd like to write a "Velocity Madlibs"
application.  You would give it a template like this:
    $first_name runs up to the $building
and it would pop up a dialog box with two text fields:
     first_name: _______
     building:   _______
which the person could fill out, and then it would generate 
the template based on what they entered.  Right now, I don't 
see how you could create such an application.  (I do see how you
could ask the user each variable, as it was encountered in the
template, but I'd like to do all the asking up front.  I don't care
about conditional.)

Obviously, this is a toy application, but it might be a good
testing tool, to help people see how their templates will look
with sample data.

Joshua Levy

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

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