velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lane Sharman <l...@san.rr.com>
Subject Re: ReferenceException
Date Mon, 02 Jul 2001 23:47:39 GMT
Piero,

The velocity introspection engine, as you've read from Geir's
post, requires getter and setter methods for public instance
members.

For classes whose role is to represent data, not behavior, or
for which there are other good reasons (performance, ease of
use), I suggest that this model is overly restrictive. The
WebMacro introspection engine allows you to set/get public
members directly.

A class with public instance members have a role to play in
applications, especially when the instance containing them is
referenced by a secure and debugged referent.

-lane



piero de salvia wrote:

> Hi guys,
>
> It's one of those days when nothing works...
>
> I have:
>
> public class Hyperlink {
>
>         public String   Location;
>         public String   Label;
> }
>
> and in my servlet I do:
>
> Hyperlink hl = new Hyperlink();
> hl.Label = "/site/section";
> hl.Location = "Section";
> ctx.put("hl", hl);
>
> and in my template I do:
>
> <a href="$hl.Location">$hl.Label</a>
>
> and my result is:
>
> <a href="$hl.Location">$hl.Label</a>
>
> plus 2 ReferenceExceptions:
>
> Tue Jul 03 00:29:21 GMT+02:00 2001   [warn]
> org.apache.velocity.runtime.exception.ReferenceException:
> reference : template = /piergi/layout/navbar.vm [line
> 6,column 42] : $hl.Location is not a valid reference.
> Tue Jul 03 00:29:21 GMT+02:00 2001   [warn]
> org.apache.velocity.runtime.exception.ReferenceException:
> reference : template = /piergi/layout/navbar.vm [line
> 6,column 56] : $hl.Label is not a valid reference.
>
> Should I give up programming?
>
> piero de salvia
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/

--
Lane Sharman
Direct: 858-755-2868
http://corporate.acctiva.com/lane
Need Commercial Credit? http://www.acctiva.com
Evolving Computation:
http://www.javaworld.com/javaworld/jw-04-2001/jw-0406-ai.html




Mime
View raw message