velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Kaufman" <BKauf...@zaplet.com>
Subject RE: Can't call methods that take interface!?
Date Thu, 10 Oct 2002 16:05:43 GMT
You can also check that the argument is correct (non-null, of the right type).  The easiest
way is to add a line like,

	$thread.creator.class

to your VTL just before the method call.

(There may also be class loader issues, but let's not get into that just yet,...)

                                                      -- Bill K.



> -----Original Message-----
> From: Claude Brisson [mailto:claude@savoirweb.com]
> Sent: Thursday, October 10, 2002 8:52 AM
> To: Velocity Users List
> Subject: Re: Can't call methods that take interface!?
> 
> 
> Have you checked the method was public ?
> 
> CloD
> ----- Original Message -----
> From: "Rickard Öberg" <rickard@dreambean.com>
> To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> Sent: jeudi 10 octobre 2002 13:48
> Subject: Can't call methods that take interface!?
> 
> 
> > Hey
> >
> > I've come across a little problem. I have a method in a 
> bean that has a
> > method that takes an interface. In my template I have access to an
> > object that implements that interface. For some reason I 
> can't call that
> > method. Velocity doesn't seem to find it. If the method and 
> object is of
> > a simple class, such as String, it works.
> >
> > Here's the actual case: I have an object implementing User. 
> My bean has
> > a formatting method "String nameOf(User aUser)" that will 
> extract the
> > name and format it properly. I want to access this in my 
> template like this:
> > $format.nameOf($thread.creator)
> >
> > (btw, it's a forum thingy)
> >
> > But it doesn't work. Any ideas how to get it to work, or 
> why it's not
> > working?
> >
> > /Rickard
> >
> > --
> > Rickard Öberg
> > rickard@dreambean.com
> > Senselogic
> >
> > Got blog? I do. http://dreambean.com
> >
> >
> > --
> > To unsubscribe, e-mail:   
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message