Struts 2 Using a State Index

I have time trying to figure out how the status index works in Struts 2 (I use Struts 2.3.4). I am trying to iterate through paragraphs 5-9 in selectedValues List String:

<s:iterator value="availableOptions" var="currentSelect" begin="5" end="9" status="status"> <td><s:select list="currentSelect" name="selectedValues" value="selectedValues" cssClass="day-select" /></td> </s:iterator> 

But he is looking for such values: selectedValues ​​[0], selectedValues ​​[1], etc., and not selectedValues ​​[5], selectedValues ​​[6] ...

The only way I can get it to work is to manually add 5, which is similar to kludge:

 <td><s:select list="currentSelect" name="selectedValues[5+#status.index]" value="selectedValues[5+#status.index]" cssClass="day-select" /></td> 

Any help would be greatly appreciated.

+4
source share
2 answers

You can try this availableOptions[%{#status.index}]selectedValues"

+1
source

Try adding the following and see if it works:

 <s:iterator value="availableOptions" var="currentSelect" begin="5" end="9" status="status" step="1"> <td><s:select list="currentSelect" name="selectedValues" value="selectedValues[#status.index]" cssClass="day-select" /></td> </s:iterator> 

Where status.index is the end-of-use function.
Step should know how to run an account.

0
source

All Articles