简体   繁体   English

Velocity模板:如何将#springMessage()的结果放入速度变量中

[英]Velocity templates : how do I put the result of #springMessage() into a velocity variable

I have a value that comes out of this statement : 我有一个来自这个声明的值:

#springMessage("count.french")

That I need to append to another string like 我需要附加到另一个字符串

#set ( $theCount = '5467 ' )

then essentially I need to do this 那么基本上我需要这样做

#set ( $countText = $theCount+#springMessage("count.french") )

but it doesn't like that. 但它不喜欢那样。 Anyone have any idea how to accomplish this? 任何人都知道如何做到这一点?

Creating a temp variable should be as simple as the following (note the quotes): 创建临时变量应该像下面这样简单(注意引号):

#set ( $test = "#springMessage( $key )" )

Then, use this however you want, ex. 然后,根据你的需要使用它,例如。 concat it to another string. 将它连接到另一个字符串。

Try the following: 请尝试以下方法:

#set($dynamicProp = '#set( $countText = $theCount ' + '#springMessage(count.french' + ' )')
#evaluate($dynamicProp)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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