Hi,

Can I take guess that the $link.set() takes a String as its second
parameter?  I've had the same problem (in reverse).  My class took an int
parameter and "1" gave the same error in the log.  I figured that automatic
type conversion wasn't done for me so I just changed the object in the
context....

I'm not sure if type conversion is such a fantastic idea.  It will influence
all kinds of stuff like arithmetic in #set and so on.  Besides it can easily
be fixed by just overloading a couple of methods.

~ Leon

----- Original Message -----
From: "Geir Magnusson Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 4:50 AM
Subject: Re: int valued expressions


> Rafal Krzewski wrote:
> >
> > Hello.
> >
> > A friend of mine has encountered something that he believes to be a bug.
> > He asked me to translate the bug report to English for him, so here
> > goes...
> >
> > Consider the following class
> >
> > public class TableView
> > {
> >     // ...
> >
> >     public int getInt()
> >     {
> >         return 1;
> >     }
> >
> >     public String getString()
> >     {
> >         return "1";
> >     }
> > }
> >
> > An instance of the above class is placed in the template context under
> > the key 'table'
> >
> > Consider the following template:
> >
> > ##...
> > $link.set("testValue",$table.getInt()) (getInt)<br>
> > $link.set("testValue","$table.getInt()") ("getInt")<br>
> > $link.set("testValue",$table.getString()) (getString)<br>
> > ##...
> >
> > The actual output of the template is as follows
> >
> > $link.set("testValue",$table.getInt()) (getInt)
> > /app/servlet/Turbine/view/BeanScreen/testValue/1/app/tabledemo
> > ("getInt")
> > /app/servlet/Turbine/view/BeanScreen/testValue/1/app/tabledemo
> > (getString)
> >
> > And the following error message appears in the log
> >
> > 2001 06 06 11:53:16 WARNING [velocity/tabledemo]  [warn]
> > org.apache.velocity.runtime.exception.ReferenceException: reference :
> > template = en_EN_HTML/screens/bean_screen.vt [line 16,column 1] :
> > $link.self().set("testValue",$table.getInt()) is not a valid reference.
> >
> > Is this a bug of (mis)feature?
>
> Hm.  It can't find, from the first use,  a method like
>
> set( Object, int )
>
> (or something like it - maybe set( String, int ) - I can't be sure...
>
> The second and third are ok because you have a
>
> set( Object, Object)
>
> (or set( String, String) ... )
>
> Also, the self() bit is a bit wierd
>
> What is the class behind the $link reference?
>
> > Rafal
> >
> > PS. If you are wondering where those blurbs come from, it is the "new"
> > Turbine....
>
> Version 2.1 ? :)
>
> (I know what you mean - I will try and find it....)
>
> geir
>
> --
> Geir Magnusson Jr.                           [EMAIL PROTECTED]
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> You have a genius for suggesting things I've come a cropper with!

Reply via email to