0

I create one text message i.e.

"vishal is working as developer, since $obj.object[0].timeStamp"

if timeStamp is null then String should replace with

"vishal is working as developer"

So I tried like "vishal is working as developer, #if ($obj.object[0].timeStamp) , since $obj.object[0].timeStamp" #end

it is not working please help me out

  • "it is not working" is not an error description. Please show the error message. If there is an exception then show the full stack trace. If there is no error, what is the output? – vanje Mar 14 '17 at 14:27
  • I could suggest to check this link :https://wiki.apache.org/velocity/CheckingForNull – soorapadman Mar 15 '17 at 07:10

1 Answers1

0

Have you got getters? Please read this: How to access an object's public fields from a Velocity template

If I were you maybe I would pass the $obj.object[0].timeStamp to the velocity not only the $obj. (Especially if you need only this value from the object)

Finally for checking the null I think soorapadman's answer is perfect.

Community
  • 1
  • 1
Paxi
  • 111
  • 11