andPat
andPat

Reputation: 4503

Use method of custom object class in Apache Velocity template

I pass to Apache Velocity template a variable of type User (created by me). User has method getUsername() and in Velocity template I use this as follows:

#if($user)
<p>
User Created $user.getUsername()
</p>
#end

but output is User Created $user.getUsername() and not User Created Pluto as expected; Why?? Can You help me??

Upvotes: 1

Views: 1172

Answers (1)

Nathan Bubna
Nathan Bubna

Reputation: 6933

That means that the value returned by the getUsername() method is null, or perhaps that that method doesn't exist.

Upvotes: 2

Related Questions