velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zerbst, Carsten" <Carsten.Zer...@PROSTEP.com>
Subject Values not resolved ?
Date Mon, 14 Aug 2006 10:57:37 GMT
Hello, 

I just started using velocity and run into a problem with non resolved attributes.
I put a list with AttributeWrappers into the context

--------------
class AttributeWrapper {
    AttributeType attr;
    
    AttributeWrapper(AttributeType attr) {
        this.attr = attr;
    }
    
    public String toString() {
        return attr.getJavaName();
    }
    public String getUppercase() {
        return attr.getJavaName().toUpperCase(Locale.ENGLISH);
    }
}
------------------

with a template like this

-------------------
 #foreach( $attr in $attributes ) 
        $attr
        ${attr.toString()}
        ${attr.Uppercase}
        ${attr.getUppercase()}     
    #end
--------------------

and the generated code looks like this


----------------------
longId
        longId
        ${attr.Uppercase}
        ${attr.getUppercase()}
-----------------------

So the default toString and explicitly requested toString method works, but the 
references to the Uppercase attribute does not. 

Could someone give me a hint what I'm doing wrong ? I use velocity 1.4 on 
Windows and Linux with a JDK 1.4.2.

Thanks, Carsten 




___
Dr.-Ing. Carsten Zerbst 

PROSTEP ITS  GmbH
Hein-Saß-Weg 19, D-21129 Hamburg

Tel: +49 40 209 1608 12
Mobil: +49 178 950 9468
E-Mail: carsten.zerbst@prostep.com
http://www.prostep.com

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


Mime
View raw message