I understand your question the way that you want to use a two dimensional viewScope variable in your repeat control.
You can define such a two dimensional array in JavaScript this way:
viewScope.myTest =
[["Val_1_1", "Val_1_2"], ["Val_2_1", "Val_2_2"], ["Val_3_1", "Val_3_2"]];
or similar to your third code snippet:
viewScope.myTest = [];
viewScope.myTest.push(["Val_1_1", "Val_1_2"]);
viewScope.myTest.push(["Val_2_1", "Val_2_2"]);
viewScope.myTest.push(["Val_3_1", "Val_3_2"]);
The repeat control iterates through the first array level and writes the second level into a variable row
:
<xp:repeat
id="repeat1"
rows="30"
var="row"
value="#{viewScope.myTest}">
<xp:text value="#{row[0]}" />
 
<xp:text value="#{row[1]}" />
<br />
</xp:repeat>
You can access the values with row[0]
and row[1]
.
This example renders the following output:
Val_1_1 Val_1_2
Val_2_1 Val_2_2
Val_3_1 Val_3_2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…