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

acces object variables inside velocity template

jacob delddd
Contributor
August 1, 2018

Is there a way to display object variables inside the velocity template?

It only seems to work with "toString()". I saw something about wrapping the object, but how would this be possible in jira?

example:

java class:

class a
{
public String name;

public String getName(){return "test";}
public String fullUsername = "test";
@Override
public String toString() {return "test";}
}

context.put("object", new a());

 

velocity template:

<html>
<head>
<title>test</title>
<meta name="decorator" content="atl.general">
</head>
<body>
<form id="" class="aui" action="" method="post">

<td>$object.getName()</td> <!-- does not work -->
<td>$object.toString()</td> <!-- works!!! -->
<td> $object.name </td> <!-- does not work -->
</form>
</body>
</html>

 

Thank you for your time!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Jira Events