velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bob mcwhirter <>
Subject RE: discarding method return values
Date Mon, 04 Nov 2002 14:26:50 GMT

Sorry for being pedantic here, but if you're calling a method and
ignore its return value in a template, then you're just wanting
the side-effects of the method call?  I'd consider that to probably
be a Bad Programming Practice.  That logic is probably better-suited
for the Controller end of things, and in the View.

Though, cheap and easy is to stick it inside HTML comments, if
you're playing with HTML.  <!-- foo.getBar() -->. 

Velocity will ignore the HTML comment gleefully, and they'll
prevent the return from being seen.


On Mon, 4 Nov 2002, Tim Colson wrote:

> It's a workaround, which of course means 'more work' for the developer,
> but sometimes I've personally used wrapper classes around even hashes so
> that I can specifically make a subset of methods available. Yeah, I'm
> paranoid. <grin>
> > I often want to discard the return values of methods. 
> Perhaps this workaround of creating a wrapper with a custom method
> signature like:
> public void add(Object obj), which delegates to 'boolean add()' and
> disposes of the unwanted return would help clean up the template, and at
> the same time keep Velocity dirt simple? :-)

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

View raw message