You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ivan Vercinsky <iv...@pxpgroup.com> on 2005/05/26 12:46:36 UTC

problem passing objects to velocity

I have this problem:

 

I'm trying to render this simple class in velocity template

class testClass{

            private String testStr = "mozole";

            public String getName(){

                        return this.testStr;

            }

 

I put it into context

 

contextMap.put("test",new testClass());

..

I render it. here are commands plus adequate result:

 

$test                             =
com.pxpgroup.project.nespos.misc.macros.testClass@5e9e34                   

$test.getName()             = $test.getName()

$test.Name                   = $test.Name

$test.name                    = $test.name

$test.getClass().getName() =
com.pxpgroup.project.nespos.misc.macros.testClass

 

Like the method getName doesn't exist or what. what am I doing wrong???

 

Can you please help me?

 

 

Thanx

 

            ivan


RE: problem passing objects to velocity

Posted by Ivan Vercinsky <iv...@pxpgroup.com>.
I found the problem...
I was missing the public modifier on class declaration...
God damned!!!!!!!!!!!!
ivan

-----Original Message-----
From: Ivan Vercinsky [mailto:ivan.vercinsky@pxpgroup.com] 
Sent: Thursday, May 26, 2005 12:47 PM
To: velocity-user@jakarta.apache.org
Subject: problem passing objects to velocity

I have this problem:

 

I'm trying to render this simple class in velocity template

class testClass{

            private String testStr = "mozole";

            public String getName(){

                        return this.testStr;

            }

 

I put it into context

 

contextMap.put("test",new testClass());

..

I render it. here are commands plus adequate result:

 

$test                             =
com.pxpgroup.project.nespos.misc.macros.testClass@5e9e34                   

$test.getName()             = $test.getName()

$test.Name                   = $test.Name

$test.name                    = $test.name

$test.getClass().getName() =
com.pxpgroup.project.nespos.misc.macros.testClass

 

Like the method getName doesn't exist or what. what am I doing wrong???

 

Can you please help me?

 

 

Thanx

 

            ivan



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