You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Marc Lustig <ma...@marclustig.com> on 2002/09/30 12:23:49 UTC

AW: How to pass object to 'Velocity' macro

However, Scott, there is one problem left:

#macro (valTextFeld $bezeichnung $feld $size)
<tr><td align="right">$bezeichnung</td><td>
<input type="Text" name="$feld.Key" value="$!feld" size="$size">
#if (!$feld.isValid())
<span style="color: red">$feld.Message</span>
#end


After the form is processed with invalid fields, the error messages do
appear, but not the values that have been typed into the input-field before.

after $feld=mygroup.myfield
"$!feld" seems not to work.

Is it necessary to use "$!mygroup.myfield" explicitly ?
Or do you know a work around to use ?

(I'm not quite sure what this "$!xxx" syntax is all about. Maybe it is
explained in Velocity how-to.)

Regards
Marc




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


Re: AW: How to pass object to 'Velocity' macro

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> Most likely it is explained there.  The '!' means
> 'don't print anything if
> the expression evaluates to null' - without the '!'
> the expression itself
> will be printed.

Well, currently it's not completely true. 
I works for simple reference, but not for methods / 
properties

$!order.receiverAddress prints out
iteself if getReceiverAddress() returns null...

I belive this could be a bug...

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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


Re: AW: How to pass object to 'Velocity' macro

Posted by Scott Eade <se...@backstagetech.com.au>.
> From: "Marc Lustig" <ma...@marclustig.com>
> 
> #macro (valTextFeld $bezeichnung $feld $size)
> <tr><td align="right">$bezeichnung</td><td>
> <input type="Text" name="$feld.Key" value="$!feld" size="$size">
> #if (!$feld.isValid())
> <span style="color: red">$feld.Message</span>
> #end
> 
> After the form is processed with invalid fields, the error messages do
> appear, but not the values that have been typed into the input-field before.
> 
> after $feld=mygroup.myfield
> "$!feld" seems not to work.
Try $!field.Value
> 
> Is it necessary to use "$!mygroup.myfield" explicitly ?
> Or do you know a work around to use ?
> 
> (I'm not quite sure what this "$!xxx" syntax is all about. Maybe it is
> explained in Velocity how-to.)
Most likely it is explained there.  The '!' means 'don't print anything if
the expression evaluates to null' - without the '!' the expression itself
will be printed.

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



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