Re: [FreeMarker-user] FW: crud screens and null.
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
|
From: Daniel D. <dd...@fr...> - 2006-05-09 15:46:53
|
Tuesday, May 9, 2006, 4:55:00 PM, Joe Hudson wrote:
[snip]
>> If you are that sure about it, then I don't know... Give me some
>> concrete examples! I have seen "" as the default value seldom... where
>> is that useful, other than for some primitive Web form handling?
>
> As far as examples, I'll tell you when this is used most often for me.
> Whenever I am displaying values in a label, value kind of presentation
> (label on the left and value on the right) and the value is a string and may
> be null, I use ?if_exists. I can't speak for anyone else but this is not an
> uncommon situation in the work that I have done.
But should not you strike out the value then? Like:
Name: -
or something? In <input name="..." value="${value}"> you shouldn't...
but that's the only case that I can tell out of my mind, and I don't
think Web form refilling should be done like that. I have written a
web form refiller for a framework, and I have to tell that refilling
forms is far more complicated than some value="${value}"-s, and thus
should not be the duty of the template authors. (In that framework,
which used FreeMarker templates, you could write plain static HTML
forms, and the template author had only to specify where the form
starts, and where it ends along with the id of the form (because the
same HTML page can contain multiple forms), and the form was just
magically filled with the values (using a transparent template
preprocessor in the background).)
>> Also, unless you use ?if_exists logic *extremely* often, isn't it
>> foo!'' and foo![] or foo!{} better than foo! is? At least it's clearly
>> visible what the default value is. I mean, you spare two keystrokes by
>> allowing just !, but is that worth the price that your template will
>> be less explicit?
>
> I would say that, for me, it does happen relatively often. Is so often that
> saving a keystroke would matter... who knows. I am certainly pre-disposed
> to wanting the $!{} syntax because I did come from Velocity.
How did you specify default values like "-", "N/A", "unknown", 0 (0 as
number) or [] (empty list) in Velocity templates? Is it possible that
you didn't used "-" and like, but instead rather generated lower
quality output that uses "", only because it was too complicated to
specify a default value other than ""?
--
Best regards,
Daniel Dekany
|