简体   繁体   中英

Prevent Apache Velocity from escaping

My template goes like this

 <tr> <td style="white-space:normal">$claim.getClaimId()</td> <td style="white-space:normal">$claim.getStatus().getValue()</td> <td style="white-space:normal; text-align:left"> $claim.getComment() </td> </tr> 

Now, when I try to build the template with the following string in the comment field "Today's weather forecast is", velocity ends up rendering it as

错误

How do I prevent it from escaping my characters?

Velocity is format-agnostic. It won't escape HTML entities by itself, so this encoding is probably done by the getComment() method.

By the way, do you know that you could write $claim.claimId , $claim.status.value and $claim.comment , and let Velocity call the getters itself?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM