You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christian Wolf <ch...@idbsoft.ch> on 2001/03/28 10:52:39 UTC

some problems in my velocity template

Hi all,

I have a problem in a velocity template.

I call the following method in my velocity template :

#set ($anInt = $url.getID())    ## url.getID returns an int
#set ($myPath = $kei.getPath($anInt, $data))

wich corresponds in my java code to :

kei.getPath(int anInt, RunData data)

I have put the "kei" object in context.

My problem is when in hardcode an int in my method, the code run correctly,
but when I write my method like $kei.getPath($anInt, $data)) with the $anInt
variable, the code doen't work !  (maybe a problem between String and int ?)

Any idea ???

- Christian




Re: some problems in my velocity template

Posted by Christian Wolf <ch...@idbsoft.ch>.
you have right,

1)  show us the method signature of getID().  Is it

      public String getID()
                ------

So we have found the problem, thanks a lot

- christian


----- Original Message -----
From: "Geir Magnusson Jr." <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Wednesday, March 28, 2001 12:51 PM
Subject: Re: some problems in my velocity template


> Christian Wolf wrote:
> >
> > Hi all,
> >
> > I have a problem in a velocity template.
> >
> > I call the following method in my velocity template :
> >
> > #set ($anInt = $url.getID())    ## url.getID returns an int
> > #set ($myPath = $kei.getPath($anInt, $data))
> >
> > wich corresponds in my java code to :
> >
> > kei.getPath(int anInt, RunData data)
> >
> > I have put the "kei" object in context.
> >
> > My problem is when in hardcode an int in my method, the code run
correctly,
> > but when I write my method like $kei.getPath($anInt, $data)) with the
$anInt
> > variable, the code doen't work !  (maybe a problem between String and
int ?)
> >
> > Any idea ???
>
> Do two things for diagnostics so we can help :
>
> 1)  show us the method signature of getID().  Is it
>
>      public int getID()
>
> ?
>
> 2) 'print' out $anInt just after the first #set() to be sure that there
> is a valid value.
>
> geir
>
> --
> Geir Magnusson Jr.                               geirm@optonline.net
> Developing for the web?  See http://jakarta.apache.org/velocity/
>


Re: some problems in my velocity template

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Christian Wolf wrote:
> 
> Hi all,
> 
> I have a problem in a velocity template.
> 
> I call the following method in my velocity template :
> 
> #set ($anInt = $url.getID())    ## url.getID returns an int
> #set ($myPath = $kei.getPath($anInt, $data))
> 
> wich corresponds in my java code to :
> 
> kei.getPath(int anInt, RunData data)
> 
> I have put the "kei" object in context.
> 
> My problem is when in hardcode an int in my method, the code run correctly,
> but when I write my method like $kei.getPath($anInt, $data)) with the $anInt
> variable, the code doen't work !  (maybe a problem between String and int ?)
> 
> Any idea ???

Do two things for diagnostics so we can help : 

1)  show us the method signature of getID().  Is it

     public int getID()

?

2) 'print' out $anInt just after the first #set() to be sure that there
is a valid value.

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.net
Developing for the web?  See http://jakarta.apache.org/velocity/