RE: [FreeMarker-user] FW: crud screens and null.
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
|
From: Payne, M. <Pay...@pe...> - 2006-05-02 13:41:41
|
So support the "!"
To express is much simpler. In addition it allows the author to say "it =
might be null, but I do not care".
-----Original Message-----
From: fre...@li... =
[mailto:fre...@li...]On Behalf Of Daniel =
Dekany
Sent: Tuesday, May 02, 2006 9:26 AM
To: Jonathan Revusky
Subject: Re: [FreeMarker-user] FW: crud screens and null.
Tuesday, May 2, 2006, 2:26:50 PM, Jonathan Revusky wrote:
[snip]
>> In practice, we have objects with null properties and that's okay.
>> Using ?default/?exists is sometimes more tedious than the error
>> freemarker is trying to prevent. Why not allow "!" e.g=20
>> $!{foo.prop.fieldx} and just print nothing if the
>
> Well, as you have intuited, we tend to think that this is a coding
> antipattern, and as such, aren't that eager to encourage it via more
> convenient notation.
>
> I'm loath to tell people how to do things OTOH, but my sense of things
> is that you would be better off if you managed to restructure your =
data
> model (I don't mean radically) such that you have a sensible default
> value rather than null. That user.getNotes() or something like that
> returns an empty string rather than null if nobody has actually =
entered
> any notes seems perfectly reasonable and would get around the whole =
problem.
[snip]
My standpoint on this problem is that while the template language
should not do arbitrary things when it sees a null value, so the user
should be forced to explicitly specify a default value, discouraging
people using null-s in the data-model (by having verbose existence
handling built-ins for example) was a failed attempt. Simply, we was
unable to provide a practically usable way of wrapping the "business
logic" objects in a way that the null-s will not be present. As a
result, it think, almost everybody extensively uses existence
built-ins in their templates.
--
Best regards,
Daniel Dekany
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, =
security?
Get stuff done quickly with pre-integrated technology to make your job =
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=120709&bid&3057&dat=121642
_______________________________________________
FreeMarker-user mailing list
Fre...@li...
https://lists.sourceforge.net/lists/listinfo/freemarker-user
This message, including any attachments, is intended only for the recipie=
nt(s) =
named above. It may contain confidential and privileged information. If y=
ou have =
received this communication in error, please notify the sender immediatel=
y and =
destroy or delete the original message. Also, please be aware that if you=
are not =
the intended recipient, any review, disclosure, copying, distribution or =
any =
action or reliance based on this message is prohibited by law. =
=0D
|