You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jonathan Revusky <jr...@terra.es> on 2001/07/15 01:33:50 UTC

Treatment of null variables in Velocity

I have been playing with Velocity recently. I actually have a first pass
of integrating velocity as an option in the Niggle web application
framework (it currently supports freemarker and webmacro, but
announcement on velocity forthcoming...). Anyway, I am rather dismayed
about how velocity treats null variables. I frequently use a pattern
where, in a form, I go:

<INPUT TYPE="TEXT" NAME="last_name" VALUE="$record.last_name" SIZE="25">

Or something like that. Where the $record is a wrapper variable around a
database record in my framework. Anyway, if last_name is null, then it
actually puts in the literal string "$record.last_name". I mean, that's
terrible! I could see where that is good at a debugging level, but
really.... I mean, otherwise, you need to make sure that you always
replace this by the empty string. Quite literally, it seems like you
need something like:

#set ($last_name="")
#if ($record.last_name) #set ($last_name = $record.last_name) #end
<INPUT TYPE="TEXT" NAME="last_name" VALUE="$last_name" SIZE="25">

This is awkward! Has there been any discussion of this?

Cheers,

Jonathan Revusky
--
available for Java/Delphi/Internet consulting
If you want to...
- make your .class files double-clickable with SmartJ
- do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
- build robust web applications with the Niggle Application Framework
then...
check out the Revusky Hacks Page: http://revusky.com/hacks/

Re: Treatment of null variables in Velocity

Posted by Warner Onstine <wa...@warneronstine.com>.
Oh, I completely understand, just pointing out some of the little tidbits in
the docs =).

-warner

----- Original Message -----
From: "Jonathan Revusky" <jr...@terra.es>
To: <ve...@jakarta.apache.org>
Sent: Saturday, July 14, 2001 5:01 PM
Subject: Re: Treatment of null variables in Velocity


> Warner Onstine wrote:
> >
> > What you actually need to do is this:
> > $!record.last_name
>
> Thank you very much!
>
> >
> > So, if the last_name var is null it outputs an empty string. This is
> > discussed in:
> >
> > http://jakarta.apache.org/velocity/user-guide.html
>
> No, I didn't read that far. I would have had to read that, since there
> is no way I would have ever guessed something like that!
>
> Jonathan Revusky
> --
> available for Java/Delphi/Internet consulting
> If you want to...
> - make your .class files double-clickable with SmartJ
> - do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
> - build robust web applications with the Niggle Application Framework
> then...
> check out the Revusky Hacks Page: http://revusky.com/hacks/
>


Re: Treatment of null variables in Velocity

Posted by Jonathan Revusky <jr...@terra.es>.
Jon Stevens wrote:
> 
> The game we are playing is the one where we put a piece of software that we
> worked really hard on for many months out into a public forum for people to
> download, contribute to and use however the heck they want.
> 
> Then, we end up supporting those people who like to tell us that we are
> arrogant, even though they don't bother to read the manuals that we
> provided.

Okay, so that's the game, huh? So how do you win?

Well, I guess you win when you've changed human nature.... when
everybody who downloads your code reads all your docs meticulously, and
when everybody is properly grateful.

Then, when you've achieved those goals...  you win!!!!

And then I'll buy you a package trip to Hawaii.

Cheers,

Jonathan Revusky
--
available for Java/Delphi/Internet consulting
If you want to...
- make your .class files double-clickable with SmartJ
- do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
- build robust web applications with the Niggle Application Framework
then...
check out the Revusky Hacks Page: http://www.revusky.com/hacks/

Re: Treatment of null variables in Velocity

Posted by Jon Stevens <jo...@latchkey.com>.
The game we are playing is the one where we put a piece of software that we
worked really hard on for many months out into a public forum for people to
download, contribute to and use however the heck they want.

Then, we end up supporting those people who like to tell us that we are
arrogant, even though they don't bother to read the manuals that we
provided.

-jon

on 7/16/01 1:21 PM, "Jonathan Revusky" <jr...@terra.es> wrote:

> Jon Stevens wrote:
>> 
>> on 7/14/01 5:01 PM, "Jonathan Revusky" <jr...@terra.es> wrote:
>> 
>>>> http://jakarta.apache.org/velocity/user-guide.html
>>> 
>>> No, I didn't read that far. I would have had to read that, since there
>>> is no way I would have ever guessed something like that!
>>> 
>>> Jonathan Revusky
>> 
>> Sigh,
>> 
>> This is a perfect example of something I see all the time:
>> 
>>     If we don't write docs, people complain that there are no docs.
>> 
>>     If we write docs, people don't read them.
>> 
>> How do we win?
> 
> Gee, I couldn't begin to tell you how you might win. I don't even know
> what game it is that you're playing.
> 
>> 
>> -jon


Re: Treatment of null variables in Velocity

Posted by Jonathan Revusky <jr...@terra.es>.
Jon Stevens wrote:
> 
> on 7/14/01 5:01 PM, "Jonathan Revusky" <jr...@terra.es> wrote:
> 
> >> http://jakarta.apache.org/velocity/user-guide.html
> >
> > No, I didn't read that far. I would have had to read that, since there
> > is no way I would have ever guessed something like that!
> >
> > Jonathan Revusky
> 
> Sigh,
> 
> This is a perfect example of something I see all the time:
> 
>     If we don't write docs, people complain that there are no docs.
> 
>     If we write docs, people don't read them.
> 
> How do we win?

Gee, I couldn't begin to tell you how you might win. I don't even know
what game it is that you're playing.

> 
> -jon

-- 
Jonathan Revusky
--
available for Java/Delphi/Internet consulting
If you want to...
- make your .class files double-clickable with SmartJ
- do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
- build robust web applications with the Niggle Application Framework
then...
check out the Revusky Hacks Page: http://www.revusky.com/hacks/

Re: How do we win?

Posted by Jon Stevens <jo...@latchkey.com>.
on 7/16/01 8:53 PM, "Nick Bauman" <ni...@cortexity.com> wrote:

> Here's some theoretical physics for you:
> 
> SHOW ME THE CODE 
> 
> and stop whinin'. Do you have any idea how you come off? ASF people gives
> you something _as a gift_ and you cry about how it's imperfect. Don't cry
> about it, improve it. THAT'S THE WHOLE POINT. =)

+1

Shut up or contribute.

-jon


Re: How do we win?

Posted by Nick Bauman <ni...@cortexity.com>.
> At 12:15 PM -0700 7/16/01, Jon Stevens wrote:
>>This is a perfect example of something I see all the time:
>>     If we don't write docs, people complain that there are no docs. If
>>     we write docs, people don't read them.
>>How do we win?

d00d...

> There is far more complex world than implied by such cartesian 
> either-or choices. The answer to your question is to avoid such bogus 
> choices altogether. The software industry is full of examples of 
>software that delights users regardless of whether they read the docs 
>or not. Apple, Microsoft and Adobe are particularly well-known 
> examples of companies who do this well.

I didn't get into Velocity so I can get a handjob from the likes of Adobe: 
This stuff works because of what you contribute. Adobe's stuff works by how 
much they can get for the software they flog. Clue! Totally different 
development approaches.

> None of this is rocket science, just common-sense, Jon. Ignore it at 
> your peril.

Here's some theoretical physics for you: 

SHOW ME THE CODE 

and stop whinin'. Do you have any idea how you come off? ASF people gives 
you something _as a gift_ and you cry about how it's imperfect. Don't cry 
about it, improve it. THAT'S THE WHOLE POINT. =)

-- 
Nick Bauman
Software Engineer
3600 Dupont
Minneapolis, MN
55412
Mobile Phone: (612) 810-7406
Home Phone: (612) 522-0165


Re: How do we win?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
(Posting to list - responded to the CC on Brad's post...)

Brad Cox wrote:
> 
> At 10:16 PM -0400 7/16/01, Geir Magnusson Jr. wrote:
> >We haven't
> >heard about an NPE for a really long time now, and if we did, we'd fix
> >it in a heart beat.  I agree there is no excuse for an NPE. (I would be
> >surprised if every bit of code you write is NPE proof....)
> 
> Last Friday, I wrote
> >  So I configured this line to read "file,class", which triggered the
> >  NullPointerException I mentioned. I didn't track it down any closer;
> >  the problem might be that I mispelled the class option, or the word
> >  "class" collided with Java somehow, or there was some other option I
> >  should have specified. Note the core problem: the lack of semantic
> >  validation of information from properties files.
> 
> You responded:
> >Yep - that's what I thought you did :)  I know that one.  Will be fixed.
> 

Ok - so if I fix it, you'll stop?

> Then in spite of repeated statements to the contrary:
> >I think the core problem is that you didn't read the docs.  Again,
> >section 10, "Configuring Resource Loaders" :
> >I really wish you would stop waving that one example around like a
> >flag...  just tell us what you did, and we will fix it.  Or you can fix
> >it and send the patch.
> 
> I explained why I won't send patches before.

I don't remember.  Sorry.  I'll look it up.
 
> >I would prefer to dicuss your ideas in an open constructive forum.  You
> >didn't approach this community with 'open' or 'constructive' as far as I
> >can tell.  I am probably wrong as I can jump to conclusions (see that
> >bit about immaturity and insufferable arrogance...:), but that's how I
> 
> When I was twenty-something I thought I knew everything too. One of
> the biggest lessons I learned since then is that it is not a virtue.

Actually, I felt the same way too.  Even a little later, into my late
twenties.  I'm my early thirties now (well, not very early, but I can
pretend...), which is only a few years of spread between now and late
twenties, I guess.

There's a point here?

> >read it.  And your responses only furthered that idea.  I saw the same
> >thing happen on tomcat-dev a while ago when  you brought JAWA up
> >there...
> 
> That's why many of my comments are directed at jakarta as a whole,
> not just Velocity.

But why?  Why not offer an alternative implementation or a patch?  Show
people what you think?  The only downside is that it will be ignored....
 
> Speaking of reading dox, did you read http://virtualschool.edu/jwaa?

Not yet - too busy  with old Jonathan over there..

I tried to get through it earlier when you posted to the tomcat lists. 
I think I even responded to you, but heard nothing back.  I will
revisit.

> >  >  Better yet, impugn their
> >>  professional capabilities, even call assholes, threaten to throw them
> >>  off the list for even questioning the developers' decision. And so
> >>  forth. If you don't know what I'm talking about, see recent traffic
> >>  on this list.
> >
> >I was a major cause of that recent traffic.  And I will note that it was
> >my professional capabilities, my maturity, my dedication that were all
> >questioned.  Not once did I resort to name calling or insults.
> 
> The message was to Jon, not you.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Re: How do we win?

Posted by Brad Cox <bc...@virtualschool.edu>.
At 10:16 PM -0400 7/16/01, Geir Magnusson Jr. wrote:
>We haven't
>heard about an NPE for a really long time now, and if we did, we'd fix
>it in a heart beat.  I agree there is no excuse for an NPE. (I would be
>surprised if every bit of code you write is NPE proof....)

Last Friday, I wrote
>  So I configured this line to read "file,class", which triggered the
>  NullPointerException I mentioned. I didn't track it down any closer;
>  the problem might be that I mispelled the class option, or the word
>  "class" collided with Java somehow, or there was some other option I
>  should have specified. Note the core problem: the lack of semantic
>  validation of information from properties files.

You responded:
>Yep - that's what I thought you did :)  I know that one.  Will be fixed.

Then in spite of repeated statements to the contrary:
>I think the core problem is that you didn't read the docs.  Again,
>section 10, "Configuring Resource Loaders" :
>I really wish you would stop waving that one example around like a
>flag...  just tell us what you did, and we will fix it.  Or you can fix
>it and send the patch.

I explained why I won't send patches before.

>I would prefer to dicuss your ideas in an open constructive forum.  You
>didn't approach this community with 'open' or 'constructive' as far as I
>can tell.  I am probably wrong as I can jump to conclusions (see that
>bit about immaturity and insufferable arrogance...:), but that's how I

When I was twenty-something I thought I knew everything too. One of 
the biggest lessons I learned since then is that it is not a virtue.

>read it.  And your responses only furthered that idea.  I saw the same
>thing happen on tomcat-dev a while ago when  you brought JAWA up
>there...

That's why many of my comments are directed at jakarta as a whole, 
not just Velocity.

Speaking of reading dox, did you read http://virtualschool.edu/jwaa?

>  >  Better yet, impugn their
>>  professional capabilities, even call assholes, threaten to throw them
>>  off the list for even questioning the developers' decision. And so
>>  forth. If you don't know what I'm talking about, see recent traffic
>>  on this list.
>
>I was a major cause of that recent traffic.  And I will note that it was
>my professional capabilities, my maturity, my dedication that were all
>questioned.  Not once did I resort to name calling or insults.

The message was to Jon, not you.
-- 
For industrial age goods there were checks and credit cards.
For everything else there is mybank.dom at http://virtualschool.edu/mybank
Brad Cox, PhD; bcox@virtualschool.edu 703 361 4751


Re: How do we win?

Posted by Jon Stevens <jo...@latchkey.com>.
Here is my next question...

How is it that we get not one, but two complete assholes (besides myself of
course <smile>) posting to this list in one single week ?

Now, if we could get two people who actually contribute something worthwhile
(it doesn't have to be code, just the to the discussion or, god forbid, the
documentation nobody reads anyway), then imagine the amount of cool stuff we
could produce together!!

:-)

-jon


Re: Multiple Engine Enhancement RE: How do we win?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
"Geir Magnusson Jr." wrote:
> 
> David Rees wrote:
> >
> > > -----Original Message-----
> > > From: gmj@mta4.srv.hcvlny.cv.net [mailto:gmj@mta4.srv.hcvlny.cv.net]On
> > >
> > > Funny - I just got out of bed to come into my office here and ask now
> > > that our weekly gratuitous slugfest is over, anyone have any comments
> > > about the multiple engine version?
> >
> > I haven't tried it (is it in the nightly?) but the posts I read from you
> > about it looked good to me.
> 
> No - it's in whitespace/geir.  

Sheesh.  /whiteboard/geir.


-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Re: Multiple Engine Enhancement RE: How do we win?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
David Rees wrote:
> 
> > -----Original Message-----
> > From: gmj@mta4.srv.hcvlny.cv.net [mailto:gmj@mta4.srv.hcvlny.cv.net]On
> >
> > Funny - I just got out of bed to come into my office here and ask now
> > that our weekly gratuitous slugfest is over, anyone have any comments
> > about the multiple engine version?
> 
> I haven't tried it (is it in the nightly?) but the posts I read from you
> about it looked good to me.

No - it's in whitespace/geir.  There is a src tgz and a binary jar.  I
don't want to check it (broad changes... big pain to back out...) in in
case it doesn't work or people don't like the approach.

Give it a whirl...

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Multiple Engine Enhancement RE: How do we win?

Posted by David Rees <dr...@ebetinc.com>.
> -----Original Message-----
> From: gmj@mta4.srv.hcvlny.cv.net [mailto:gmj@mta4.srv.hcvlny.cv.net]On
>
> Funny - I just got out of bed to come into my office here and ask now
> that our weekly gratuitous slugfest is over, anyone have any comments
> about the multiple engine version?

I haven't tried it (is it in the nightly?) but the posts I read from you
about it looked good to me.

-Dave


Re: How do we win?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
David Rees wrote:
> 
> > -----Original Message-----
> > From: Neil Henderson [mailto:neilh@softtech.co.nz]
> >
> > Well thats my rant over with. I've just added my one post to the long line
> > of posts about this topic. You never know we might actually have
> > a question
> > about Veocity come along soon aswell:)
> 
> Here's one that Geir can answer.  ;-)
> 
> What's the upcoming plans for Velocity?
> 
> Is a 1.1.1 going to be released or are you shooting straight for 1.2 which
> will include multiple Velocity engines per classloader support?

I would like to see us go to a 1.2 to release the multiple engine
support if it's what people want and like, and the solution is deemed
satisfactory.

There are a few other little nips and tucks, and of course more
documentation, but I think that the engines thing is the biggie.  I know
that Jason and fellow Turbiners are going to need it for the
2.2/3.0/whatever-they-decide-to-call-it, so getting that put to bed
might be good to focus on.

Funny - I just got out of bed to come into my office here and ask now
that our weekly gratuitous slugfest is over, anyone have any comments
about the multiple engine version?

:)

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: How do we win?

Posted by David Rees <dr...@ebetinc.com>.
> -----Original Message-----
> From: Neil Henderson [mailto:neilh@softtech.co.nz]
>
> Well thats my rant over with. I've just added my one post to the long line
> of posts about this topic. You never know we might actually have
> a question
> about Veocity come along soon aswell:)

Here's one that Geir can answer.  ;-)

What's the upcoming plans for Velocity?

Is a 1.1.1 going to be released or are you shooting straight for 1.2 which
will include multiple Velocity engines per classloader support?

Whenever a new release of Velocity is made, we all win.  ;-)

-Dave


RE: How do we win?

Posted by Neil Henderson <ne...@softtech.co.nz>.
I agree with the last few posts.

I'm sure we'd all love to have a discussion about how to make things better
and actually "discuss" (discuss that is, as opposed to arguing about who's
best) things on the forum.

I lurk around on here as i'm mainly involved in the html presentation layer
but i do read most of the other posts. I have got sick of reading comments
that are just saying "I think my view is the right one, and as you disagree
i'll slag you off abit". Which is pretty much whats happened. And who cares
if someone


I don't think there's a single person on the list that will object ot
"Useful" discussion on any topic related to Velocity but just argueing as to
who's best is stupid and just goes to annoy everyone.

This has got way too out of hand for it's own good.

I suspect people are just continuing this out of wanting to be annoying to
the other person now though.


Well thats my rant over with. I've just added my one post to the long line
of posts about this topic. You never know we might actually have a question
about Veocity come along soon aswell:)

NEIL



Re: How do we win?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Brad Cox wrote:
> 
> At 12:15 PM -0700 7/16/01, Jon Stevens wrote:
> >This is a perfect example of something I see all the time:
> >     If we don't write docs, people complain that there are no docs.
> >     If we write docs, people don't read them.
> >How do we win?
> 
> Since you put it as a question, I'll respond to it as such. Politely,
> which is far from what I feel like doing.
> 
> There is far more complex world than implied by such cartesian
> either-or choices. The answer to your question is to avoid such bogus
> choices altogether. The software industry is full of examples of
> software that delights users regardless of whether they read the docs
> or not. Apple, Microsoft and Adobe are particularly well-known
> examples of companies who do this well.

You are 100% right, but I would argue (being argumentative) that only 2
of the three you mention truely delight with real innovation. 

> If you want to win, deliver products that *delight* your users
> whether they read the manuals or not. Software that anticipates
> common mistakes and silently prevents them (via menus that only
> contain valid entries) or when that's not possible, describes the
> problem in the user's frame of reference (stack backtraces do not
> qualify).
> 
> If you want to lose, write software that throws NullPointerExceptions
> or segfaults upon the slightest mistake (see mod_jk, Tomcat, and
> Velocity for great examples of this). Then blame the user on public
> listservs for not reading the manual.

You know, I don't think you made the 'slightest mistake'.  We haven't
heard about an NPE for a really long time now, and if we did, we'd fix
it in a heart beat.  I agree there is no excuse for an NPE. (I would be
surprised if every bit of code you write is NPE proof....)

I really wish you would stop waving that one example around like a
flag...  just tell us what you did, and we will fix it.  Or you can fix
it and send the patch.  

I would prefer to dicuss your ideas in an open constructive forum.  You
didn't approach this community with 'open' or 'constructive' as far as I
can tell.  I am probably wrong as I can jump to conclusions (see that
bit about immaturity and insufferable arrogance...:), but that's how I
read it.  And your responses only furthered that idea.  I saw the same
thing happen on tomcat-dev a while ago when  you brought JAWA up
there...

>  Better yet, impugn their
> professional capabilities, even call assholes, threaten to throw them
> off the list for even questioning the developers' decision. And so
> forth. If you don't know what I'm talking about, see recent traffic
> on this list.

I was a major cause of that recent traffic.  And I will note that it was
my professional capabilities, my maturity, my dedication that were all
questioned.  Not once did I resort to name calling or insults.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Re: How do we win?

Posted by James Maes <jm...@sportingnews.com>.

This is a development framework, not Microsoft Word. Velocity (and
Tomcat, Apache, Unix in general, etc..) is not targeted towards my mother,
or the average, but the techical devleper.  One does (and should be able
to) assume a level of understanding and ability.  Read the docs.

On Mon, 16 Jul 2001, Brad Cox wrote:

> At 12:15 PM -0700 7/16/01, Jon Stevens wrote:
> >This is a perfect example of something I see all the time:
> >     If we don't write docs, people complain that there are no docs.
> >     If we write docs, people don't read them.
> >How do we win?
> 
> Since you put it as a question, I'll respond to it as such. Politely, 
> which is far from what I feel like doing.
> 
> There is far more complex world than implied by such cartesian 
> either-or choices. The answer to your question is to avoid such bogus 
> choices altogether. The software industry is full of examples of 
> software that delights users regardless of whether they read the docs 
> or not. Apple, Microsoft and Adobe are particularly well-known 
> examples of companies who do this well.
> 
> If you want to win, deliver products that *delight* your users 
> whether they read the manuals or not. Software that anticipates 
> common mistakes and silently prevents them (via menus that only 
> contain valid entries) or when that's not possible, describes the 
> problem in the user's frame of reference (stack backtraces do not 
> qualify).
> 
> If you want to lose, write software that throws NullPointerExceptions 
> or segfaults upon the slightest mistake (see mod_jk, Tomcat, and 
> Velocity for great examples of this). Then blame the user on public 
> listservs for not reading the manual. Better yet, impugn their 
> professional capabilities, even call assholes, threaten to throw them 
> off the list for even questioning the developers' decision. And so 
> forth. If you don't know what I'm talking about, see recent traffic 
> on this list.
> 
> None of this is rocket science, just common-sense, Jon. Ignore it at 
> your peril.
> 

-- 




 
 
------------------------------------
|| James Maes                       
|| Senior Programmer                
|| The Sportingnews Online              
|| www.sportingnews.com                  
------------------------------------ 


How do we win?

Posted by Brad Cox <bc...@virtualschool.edu>.
At 12:15 PM -0700 7/16/01, Jon Stevens wrote:
>This is a perfect example of something I see all the time:
>     If we don't write docs, people complain that there are no docs.
>     If we write docs, people don't read them.
>How do we win?

Since you put it as a question, I'll respond to it as such. Politely, 
which is far from what I feel like doing.

There is far more complex world than implied by such cartesian 
either-or choices. The answer to your question is to avoid such bogus 
choices altogether. The software industry is full of examples of 
software that delights users regardless of whether they read the docs 
or not. Apple, Microsoft and Adobe are particularly well-known 
examples of companies who do this well.

If you want to win, deliver products that *delight* your users 
whether they read the manuals or not. Software that anticipates 
common mistakes and silently prevents them (via menus that only 
contain valid entries) or when that's not possible, describes the 
problem in the user's frame of reference (stack backtraces do not 
qualify).

If you want to lose, write software that throws NullPointerExceptions 
or segfaults upon the slightest mistake (see mod_jk, Tomcat, and 
Velocity for great examples of this). Then blame the user on public 
listservs for not reading the manual. Better yet, impugn their 
professional capabilities, even call assholes, threaten to throw them 
off the list for even questioning the developers' decision. And so 
forth. If you don't know what I'm talking about, see recent traffic 
on this list.

None of this is rocket science, just common-sense, Jon. Ignore it at 
your peril.
-- 
For industrial age goods there were checks and credit cards.
For everything else there is mybank.dom at http://virtualschool.edu/mybank
Brad Cox, PhD; bcox@virtualschool.edu 703 361 4751


Re: Treatment of null variables in Velocity

Posted by Jon Stevens <jo...@latchkey.com>.
on 7/14/01 5:01 PM, "Jonathan Revusky" <jr...@terra.es> wrote:

>> http://jakarta.apache.org/velocity/user-guide.html
> 
> No, I didn't read that far. I would have had to read that, since there
> is no way I would have ever guessed something like that!
> 
> Jonathan Revusky

Sigh,

This is a perfect example of something I see all the time:

    If we don't write docs, people complain that there are no docs.

    If we write docs, people don't read them.

How do we win?

-jon


Re: Treatment of null variables in Velocity

Posted by Jonathan Revusky <jr...@terra.es>.
Warner Onstine wrote:
> 
> What you actually need to do is this:
> $!record.last_name

Thank you very much!

> 
> So, if the last_name var is null it outputs an empty string. This is
> discussed in:
> 
> http://jakarta.apache.org/velocity/user-guide.html

No, I didn't read that far. I would have had to read that, since there
is no way I would have ever guessed something like that!

Jonathan Revusky
--
available for Java/Delphi/Internet consulting
If you want to...
- make your .class files double-clickable with SmartJ
- do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
- build robust web applications with the Niggle Application Framework
then...
check out the Revusky Hacks Page: http://revusky.com/hacks/

Re: Treatment of null variables in Velocity

Posted by Warner Onstine <wa...@warneronstine.com>.
What you actually need to do is this:
$!record.last_name

So, if the last_name var is null it outputs an empty string. This is
discussed in:

http://jakarta.apache.org/velocity/user-guide.html

-warner

----- Original Message -----
From: "Jonathan Revusky" <jr...@terra.es>
To: <ve...@jakarta.apache.org>
Sent: Saturday, July 14, 2001 4:33 PM
Subject: Treatment of null variables in Velocity


> I have been playing with Velocity recently. I actually have a first pass
> of integrating velocity as an option in the Niggle web application
> framework (it currently supports freemarker and webmacro, but
> announcement on velocity forthcoming...). Anyway, I am rather dismayed
> about how velocity treats null variables. I frequently use a pattern
> where, in a form, I go:
>
> <INPUT TYPE="TEXT" NAME="last_name" VALUE="$record.last_name" SIZE="25">
>
> Or something like that. Where the $record is a wrapper variable around a
> database record in my framework. Anyway, if last_name is null, then it
> actually puts in the literal string "$record.last_name". I mean, that's
> terrible! I could see where that is good at a debugging level, but
> really.... I mean, otherwise, you need to make sure that you always
> replace this by the empty string. Quite literally, it seems like you
> need something like:
>
> #set ($last_name="")
> #if ($record.last_name) #set ($last_name = $record.last_name) #end
> <INPUT TYPE="TEXT" NAME="last_name" VALUE="$last_name" SIZE="25">
>
> This is awkward! Has there been any discussion of this?
>
> Cheers,
>
> Jonathan Revusky
> --
> available for Java/Delphi/Internet consulting
> If you want to...
> - make your .class files double-clickable with SmartJ
> - do Delphi/Java mixed programming with easy-to-use JNI wrapper classes
> - build robust web applications with the Niggle Application Framework
> then...
> check out the Revusky Hacks Page: http://revusky.com/hacks/
>