简体   繁体   中英

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)

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