using put on a map in velocity prints the instruction [duplicate]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
This question already has an answer here:
Velocity Template engine - key-value-map
2 answers
I have a map in a velocity template that is dynamically modified. A simplified example to illustrate the point is below.
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
$testMap.put("a", "A")
$testMap.put("b", "B")
$testMap
The above generates
$testMap.put("a", "A") $testMap.put("b", "B") {a=A, b=B}
I don't want the "put" instructions to show in the template.
velocity
marked as duplicate by William Burnham, Community♦ Jan 3 at 12:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Velocity Template engine - key-value-map
2 answers
I have a map in a velocity template that is dynamically modified. A simplified example to illustrate the point is below.
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
$testMap.put("a", "A")
$testMap.put("b", "B")
$testMap
The above generates
$testMap.put("a", "A") $testMap.put("b", "B") {a=A, b=B}
I don't want the "put" instructions to show in the template.
velocity
marked as duplicate by William Burnham, Community♦ Jan 3 at 12:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51
add a comment |
This question already has an answer here:
Velocity Template engine - key-value-map
2 answers
I have a map in a velocity template that is dynamically modified. A simplified example to illustrate the point is below.
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
$testMap.put("a", "A")
$testMap.put("b", "B")
$testMap
The above generates
$testMap.put("a", "A") $testMap.put("b", "B") {a=A, b=B}
I don't want the "put" instructions to show in the template.
velocity
This question already has an answer here:
Velocity Template engine - key-value-map
2 answers
I have a map in a velocity template that is dynamically modified. A simplified example to illustrate the point is below.
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
$testMap.put("a", "A")
$testMap.put("b", "B")
$testMap
The above generates
$testMap.put("a", "A") $testMap.put("b", "B") {a=A, b=B}
I don't want the "put" instructions to show in the template.
This question already has an answer here:
Velocity Template engine - key-value-map
2 answers
velocity
velocity
asked Jan 3 at 10:12
William BurnhamWilliam Burnham
2,6481720
2,6481720
marked as duplicate by William Burnham, Community♦ Jan 3 at 12:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by William Burnham, Community♦ Jan 3 at 12:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51
add a comment |
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51
add a comment |
2 Answers
2
active
oldest
votes
I suggest you initialize your map with entries:
#set (testMap = {"a" : "A" , "b" : "B"})
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; theput
instructions are done later dynamically inside of a loop and a few conditions.
– William Burnham
Jan 3 at 10:19
add a comment |
To stop it from printing the instruction, I used dummy assignment variables
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
#set($tmp = $testMap.put("a", "A"))
#set($tmp = $testMap.put("b", "B"))
$testMap
This prints
{a=A, b=B}
A similar question is here.
I don't think it's a duplicate; Map.put(K, V)
returns the V
which isn't the same as the string literal $testMap.put("a", "A")
.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I suggest you initialize your map with entries:
#set (testMap = {"a" : "A" , "b" : "B"})
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; theput
instructions are done later dynamically inside of a loop and a few conditions.
– William Burnham
Jan 3 at 10:19
add a comment |
I suggest you initialize your map with entries:
#set (testMap = {"a" : "A" , "b" : "B"})
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; theput
instructions are done later dynamically inside of a loop and a few conditions.
– William Burnham
Jan 3 at 10:19
add a comment |
I suggest you initialize your map with entries:
#set (testMap = {"a" : "A" , "b" : "B"})
I suggest you initialize your map with entries:
#set (testMap = {"a" : "A" , "b" : "B"})
answered Jan 3 at 10:18
user7294900user7294900
24.2k123565
24.2k123565
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; theput
instructions are done later dynamically inside of a loop and a few conditions.
– William Burnham
Jan 3 at 10:19
add a comment |
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; theput
instructions are done later dynamically inside of a loop and a few conditions.
– William Burnham
Jan 3 at 10:19
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; the
put
instructions are done later dynamically inside of a loop and a few conditions.– William Burnham
Jan 3 at 10:19
Hi, thanks for your input. I would have liked to do that but the map's contents aren't known when it's initialized; the
put
instructions are done later dynamically inside of a loop and a few conditions.– William Burnham
Jan 3 at 10:19
add a comment |
To stop it from printing the instruction, I used dummy assignment variables
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
#set($tmp = $testMap.put("a", "A"))
#set($tmp = $testMap.put("b", "B"))
$testMap
This prints
{a=A, b=B}
A similar question is here.
I don't think it's a duplicate; Map.put(K, V)
returns the V
which isn't the same as the string literal $testMap.put("a", "A")
.
add a comment |
To stop it from printing the instruction, I used dummy assignment variables
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
#set($tmp = $testMap.put("a", "A"))
#set($tmp = $testMap.put("b", "B"))
$testMap
This prints
{a=A, b=B}
A similar question is here.
I don't think it's a duplicate; Map.put(K, V)
returns the V
which isn't the same as the string literal $testMap.put("a", "A")
.
add a comment |
To stop it from printing the instruction, I used dummy assignment variables
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
#set($tmp = $testMap.put("a", "A"))
#set($tmp = $testMap.put("b", "B"))
$testMap
This prints
{a=A, b=B}
A similar question is here.
I don't think it's a duplicate; Map.put(K, V)
returns the V
which isn't the same as the string literal $testMap.put("a", "A")
.
To stop it from printing the instruction, I used dummy assignment variables
#set($testMap = {})
## this stuff isn't static so I can't just create
## the map as key-value pairs in the declaration
#set($tmp = $testMap.put("a", "A"))
#set($tmp = $testMap.put("b", "B"))
$testMap
This prints
{a=A, b=B}
A similar question is here.
I don't think it's a duplicate; Map.put(K, V)
returns the V
which isn't the same as the string literal $testMap.put("a", "A")
.
answered Jan 3 at 10:18
William BurnhamWilliam Burnham
2,6481720
2,6481720
add a comment |
add a comment |
Are you looking for this stackoverflow.com/questions/16398116/…?
– soorapadman
Jan 3 at 10:51