velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Hendler <matthias.hend...@siv.de>
Subject Re: Values not resolved ?
Date Mon, 14 Aug 2006 15:56:49 GMT
Hello Carsten,

well, I am not sure, but your class is defined as package private.
Define the class public and try again.

On the other hand you can also leave the "{}" out.


Thumbs up :-)
Matthias





Zerbst, Carsten schrieb:

>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
>
>
>  
>


-- 
Mit freundlichen Grüßen

Matthias Hendler

Technologie

SIV.AG
Konrad-Zuse-Str. 1
18184 Roggentin

Telefon: +49 (0)3 81 / 25 24 - 0
Telefax: +49 (0)3 81 / 25 24 - 4 99




mailto:matthias.hendler@siv.de
http://www.siv.de



**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity
to whom they are addressed. The views expressed in this
e-mail are those of the individual author and not necessarily
those of SIV.AG.

This footnote also confirms that this email message has
been swept by serval anti-virus tools for the presence
of computer viruses.
*********************************************************************




---------------------------------------------------------------------
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