I can't seem to find any information out there on this, but basically this is the situation. I need to display a set of strings, in this case they are peroids of hours. I'm trying to avoid writing a Java class but I can do that if it's necessary. Basically I want to display something like
1-2pm
2-3pm
3-4pm
4-5pm
I tried creating a list and a variable and then just doing
new ArrayList
assigning that to a variable and then doing a
$V{my_var}.add("1-2pm")
but when I assign that variable to a list it doesn't seem to work. How is this normally handled? I would ideally want a way to simply do this with the expression editor.
You can use Arrays.asList(T... a) method in variable expression.
The example:
<variable name="listVar" class="java.util.List">
<variableExpression><![CDATA[Arrays.asList(new String[] {"1-2pm", "2-3pm", "3-4pm", "4-5pm"})]]></variableExpression>
<initialValueExpression><![CDATA[Arrays.asList(new String[] {"1-2pm", "2-3pm", "3-4pm", "4-5pm"})]]></initialValueExpression>
</variable>