Fernando Barrocal Fernando Barrocal - 1 year ago 94
Java Question

How I hide empty Velocity variable names?

I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example:

Name: Fernando

Age: {person.age}

Sex: Male

I would like to know how to hide it!

Answer Source

You can mark variables as "silent" like this:


If $variable is null, nothing will be rendered. If it is not null, its value will render as it normally would.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download