Well, i've got no problems getting Velocity to call public methods on
instances of publicly declared classes.  Got any more info you can
share?  Like the class in question?  Velocity version?  Log messages?
Anything?

On Wed, Jun 1, 2011 at 7:53 PM, Logan Stinger <lstin...@bluelid.com> wrote:
> The class is very simple right now, public class with 5 public getters and 
> setters.  Nothing else to it.  I've tried sticking a few other classes in the 
> context to test them.  I have been unable to get anything but the toString 
> representation of any of them.
>
> On Jun 1, 2011, at 5:15 PM, Nathan Bubna wrote:
>
>> The class of the object and the method itself must be declared public.
>>
>> On Wed, Jun 1, 2011 at 1:38 PM, Logan Stinger <lstin...@bluelid.com> wrote:
>>
>>> I have the following code:
>>>
>>> …
>>>
>>> List<ICODocument> history =
>>> repository.getDocumentHistoryForId("8B2F2F53-7DEA-45B6-84BA-60F2FA11F07D");
>>>
>>> context.put("documentHistory", history);
>>>
>>>
>>>
>>> Then in my notes.vm file I have the following:
>>>
>>> #foreach($doc in $response.response.get("documentHistory"))
>>>
>>> $doc
>>>
>>> #end
>>>
>>>
>>>
>>> The rendered output is what I would expect.  However, I don’t want to see
>>> the toString() representation of my object.  I want to see the value of a
>>> particular method call on my object.
>>>
>>>
>>>
>>> So I changed my notes.vm to be this:
>>>
>>> #foreach($doc in $response.response.get("documentHistory"))
>>>
>>> $doc.isMax()
>>>
>>> #end
>>>
>>>
>>>
>>> In this case my rendered output is simply:
>>>
>>> $doc.isMax() $doc.isMax()
>>>
>>>
>>>
>>> I was under the impression that I could add any java object to the velocity
>>> context and call any method on that object in my velocity template.  Am I
>>> misunderstanding?
>>>
>>>
>>>
>>>
>>>
>>> *Logan Stinger*
>>>
>>> *[image: Description: bluelid_logo_small]*
>>>
>>> * *
>>>
>>> (515) 281-6702
>>>
>>> (515) 822-8212
>>>
>>> lstin...@bluelid.com
>>>
>>>
>>>
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>

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

Reply via email to