You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by todd fahrner <fa...@pobox.com> on 2002/04/19 20:52:01 UTC

Feature request: printContext

Before Velocity, all of my server-side 'programming' experience was 
limited to Apache's XSSI. The thing I miss most about XSSI is the 
PRINTENV directive, which would print all the currently set variables 
and their values. Priceless for debugging, or simply for laying out the 
tools at one's disposal. There appears to be no equivalent in Velocity. 
There's no way to know what's in context short of RTFM, which doesn't 
exist in our case, or sleuthing through Java that I, as a lowly Web 
designer type, am not supposed to have to understand. I have likened 
Velocity to Battleship, where you guess at likely-sounding coordinates 
in context space until you hit something. Trying to solve some UI 
problem, I never *know* whether I have all the Java hooks I need until 
after wasting a lot of time and developer patience asking about what's 
in context.

I would kill for a printContext thingie in Velocity. It would go a long 
way toward backing up this statement:

"When Velocity is used for web development, Web designers can [...] 
focus solely on creating a site that looks good, and programmers can 
focus solely on writing top-notch code."


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


RE: Feature request: printContext

Posted by Paulo Gaspar <pa...@krankikom.de>.
> Come on, that's marketing.  When I use Velocity for web development, not
> only are my sites ugly, but my code is suspect too.

No! Its true! It only does not work when the designer is bad.
=;o)

(Ok, forget about top-notch code for pages-built-in-a-hurry.)


One thing I sure like about Velocity is that the designers keep
improving the pages after my side of the job is done without
bothering me. Usually it goes like this:
 - they (designers) give me some draft design while I am still 
   coding, usually just with some logo and some visuals around 
   the page and not much more;

 - Then, using all my artistic talent, I turn that into working
   page, filled with data and my own interpretation of their
   design ideas to fill the many gaps. Because my artistic 
   talent is what it is... it does not look so good;

 - After they (designers) had some time to do their work, I 
   look back at the page again and I often ask myself:
     "Was I really part of this???"
   =;o)


Have fun,
Paulo

http://www.krankikom.de
http://www.ruhronline.de
 

> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Friday, April 19, 2002 9:03 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Feature request: printContext
> 
> 
> On 4/19/02 2:52 PM, "todd fahrner" <fa...@pobox.com> wrote:
> 
....
>  
> > I would kill for a printContext thingie in Velocity. It would go a long
> > way toward backing up this statement:
> > 
> > "When Velocity is used for web development, Web designers can [...]
> > focus solely on creating a site that looks good, and programmers can
> > focus solely on writing top-notch code."
> 
> Come on, that's marketing.  When I use Velocity for web development, not
> only are my sites ugly, but my code is suspect too.
> 
> :)
> 


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


RE: Feature request: printContext

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
I was composing a response to this but Geir beat me to the punch (as
always).
Of course, his answer is much better.  I didn't think of putting the context
into the context - very clever.

But I did realize that you could put what Geir said below in a macro:

#macro( PRINTENV )
  #foreach($contextkey in $context.getKeys())

    key : $contextkey  value : $context.get($contextkey)

  #end
#end


Put that in your VM_global_library.vm and then in every template you can

#PRINTENV()

and blamo!  There is your environment.

Hope that helps.

Charlie

> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Friday, April 19, 2002 3:03 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Feature request: printContext
>
>
> On 4/19/02 2:52 PM, "todd fahrner" <fa...@pobox.com> wrote:
>
> > Before Velocity, all of my server-side 'programming' experience was
> > limited to Apache's XSSI. The thing I miss most about XSSI is the
> > PRINTENV directive, which would print all the currently set variables
> > and their values. Priceless for debugging, or simply for laying out the
> > tools at one's disposal. There appears to be no equivalent in Velocity.
> > There's no way to know what's in context short of RTFM, which doesn't
> > exist in our case, or sleuthing through Java that I, as a lowly Web
> > designer type, am not supposed to have to understand. I have likened
> > Velocity to Battleship, where you guess at likely-sounding coordinates
> > in context space until you hit something. Trying to solve some UI
> > problem, I never *know* whether I have all the Java hooks I need until
> > after wasting a lot of time and developer patience asking about what's
> > in context.
>
> Well, all  you have to do is put the context into itself :
>
>  context.put("context",context);
>
> And then in your template
>
>   #foreach($contextkey in $context.getKeys())
>
>      key : $contextkey  value : $context.get($contextkey)
>
>   #end
>
>
>
> > I would kill for a printContext thingie in Velocity. It would go a long
> > way toward backing up this statement:
> >
> > "When Velocity is used for web development, Web designers can [...]
> > focus solely on creating a site that looks good, and programmers can
> > focus solely on writing top-notch code."
>
> Come on, that's marketing.  When I use Velocity for web development, not
> only are my sites ugly, but my code is suspect too.
>
> :)
>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
> --
> Geir Magnusson Jr.
> geirm@optonline.net
> System and Software Consulting
> "Whoever would overthrow the liberty of a nation must begin by
> subduing the
> freeness of speech." - Benjamin Franklin
>
>
>
> --
> 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: Feature request: printContext

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/19/02 2:52 PM, "todd fahrner" <fa...@pobox.com> wrote:

> Before Velocity, all of my server-side 'programming' experience was
> limited to Apache's XSSI. The thing I miss most about XSSI is the
> PRINTENV directive, which would print all the currently set variables
> and their values. Priceless for debugging, or simply for laying out the
> tools at one's disposal. There appears to be no equivalent in Velocity.
> There's no way to know what's in context short of RTFM, which doesn't
> exist in our case, or sleuthing through Java that I, as a lowly Web
> designer type, am not supposed to have to understand. I have likened
> Velocity to Battleship, where you guess at likely-sounding coordinates
> in context space until you hit something. Trying to solve some UI
> problem, I never *know* whether I have all the Java hooks I need until
> after wasting a lot of time and developer patience asking about what's
> in context.

Well, all  you have to do is put the context into itself :

 context.put("context",context);

And then in your template

  #foreach($contextkey in $context.getKeys())

     key : $contextkey  value : $context.get($contextkey)
 
  #end


 
> I would kill for a printContext thingie in Velocity. It would go a long
> way toward backing up this statement:
> 
> "When Velocity is used for web development, Web designers can [...]
> focus solely on creating a site that looks good, and programmers can
> focus solely on writing top-notch code."

Come on, that's marketing.  When I use Velocity for web development, not
only are my sites ugly, but my code is suspect too.

:)

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

-- 
Geir Magnusson Jr.                                      geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



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