Question

How do I access an element from an array in a properties file?

testKey = word1,word2,word3

Something like this is not working (assume properties file is mapped to "msg"

#{msg.testKey[0]} <- to access first element
Was it helpful?

Solution

It's a String, not a String[]. You've got to split it on the comma first by fn:split() to get a String[] out of it so that you can access the items by an index.

#{fn:split(msg.testKey, ',')[0]}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top