velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <>
Subject Re: catching unbound methods?
Date Sun, 13 Oct 2002 06:00:14 GMT
Mark said:
> If there is an unbound symbol such as
>    $claendar
> then there is an event and (by default) a log warning.

i don't believe this is accurate.  to my knowledge, the null references only
cause errors when they are within a VTL directive.  e.g.

#set( $foo = $somenull )  or #if( $bar > $someothernull )bar!#end

a reference such as $somenull that is just out there in the template on its
own will be treated as just so much schmoo and render as '$somenull'

> The same is true (I believe) if there is a reference to an unbound member:
>   $calendar.FirstDayOfWeak
> But if there is a spelling mistake in a method name:
>   $calendar.getFirstDayOfWeak()
> Then there is no warning, no event, no nothing.

no, velocity does not access class members, only methods.  so the reference

$ will try to find a method like getFoo(), getfoo(), foo(), isFoo(),
and so on... (i'm not sure on the order or extent of the algorithm though, i
think it has recently changed)

thus,  $calendar.FirstDayOfWeak is no different than

i suggest you RTM (read the manuals) more carefully.  looking into the code
at and such is NOT the way to begin.

Nathan Bubna

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message