Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Weird behavior of velocity

Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2013

Hi,

I have a strange issue with velocity. I display a list of objects in a page. The velocity file is as simple as:

<ul>

#foreach ($entry in $mylist)

<li>

$entry.id

$entry.class

</li>

#end

</ul>

The rendered page displays the following:

$entry.id class com.xxx.app.MyClass

...

so it can recognize the "getClass" method from object, and shows the correct value, but it fails to resolve the "id" property from my custom class (which exists for 100% sure). The behavior is the same, if I use a public variable or a getter in "MyClass"...

Any idea?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

Are you sure the getId() method returns any value ? In case the method returns null, velocity will display $entry.id instead of "null"

Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

Unfortunately, I don't return null... when I display $entry, it shows values from my toString method, and none are null.

This is driving me crazy!

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

Have you tried calling $entry.getId()

Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

That works! Thanks!!

0 votes
Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2013

* for Jira 6.x

TAGS
AUG Leaders

Atlassian Community Events