velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Romianowski" <megap...@gmx.de>
Subject RE: String to Int
Date Tue, 10 Dec 2002 11:36:15 GMT
You cannot call static Methods from VTL. Rewrite your class to:

public class MyClass {
  
  private MyClass instance = new MyClass();

  public static MyClass getInstance() {
    return instance;
  } 

  public String process(Map map) {
  ..........
  }
  
}

And then add MyClass.getInstance() to your context.

Peter

> -----Original Message-----
> From: Cocosila [mailto:cocosila@home.ro] 
> Sent: Tuesday, December 10, 2002 10:24 AM
> To: Velocity Users List
> Subject: Re: String to Int
> 
> 
> Hello, 
> 
> Your sample code works perfect:
> 
>  #set($int = 1)
>  #set($val = $int.parseInt("4"))
> 
>  #foreach($val in [0..$val])
>   $val
>  #end
> 
> But when I tried to do the same with a public final 
> class defined by me:
> 
> public final class MyClass {
> 
>  public static final String process(Map map) {
>  ..........
>  }
>  
> }
> 
> the following syntax does not work:
>  $myClass.process($map)
>  
> Any suggestions ?
> 
> Best regards,
>  Dan
> 
> 
> --
> 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