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?
Community moderators have prevented the ability to post new answers.
Are you sure the getId() method returns any value ? In case the method returns null, velocity will display $entry.id instead of "null"
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried calling $entry.getId()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That works! Thanks!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
* for Jira 6.x
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.