change

class AttributeWrapper {

to

public class AttributeWrapper {

because both the class and the method must be public.

On 8/14/06, Zerbst, Carsten <[EMAIL PROTECTED]> wrote:
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: [EMAIL PROTECTED]
http://www.prostep.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to