To answer the question "how to pass a List from ActionA to ActionB without using the Session":
This will iterate through your whole List, and will generate an <s:hidden/>
element for every element of the List; this way, you can pass an un-altered List from one Action to another.
in case of a List<Object>
, where the object is that you've posted in the page:
<s:iterator value="formList" status="row">
<s:hidden name="formList[%{#row.index}].id" />
<s:hidden name="formList[%{#row.index}].name" />
<s:hidden name="formList[%{#row.index}].status" />
<s:hidden name="formList[%{#row.index}].type" />
<s:hidden name="formList[%{#row.index}].unit" />
</s:iterator>
Exactly as before, this will iterate through your whole List, generating five elements for every object of the List.
Using this concept, you can alter the List by using interactive tags (textfield, select, etc) instead of read-only tags (hidden, property etc):
<s:iterator value="formList" status="row">
<s:hidden name="formList[%{#row.index}].id" />
<s:textfield name="formList[%{#row.index}].name" value="name" />
<s:hidden name="formList[%{#row.index}].status" />
<s:property value="status" />
<s:textfield name="formList[%{#row.index}].type" value="type" />
<s:textfield name="formList[%{#row.index}].unit" value="unit" />
</s:iterator>
Of course your List will be vulnerable to client-side changes, every user able to press F12 will be able to modify your List, then you should be careful.
You could, for example, put only the ID**s in the **session, inject the List in the JSP, then when receiving the data back, match the *ID*s of List coming from the page with the *ID*s you have in Session, for checking the integrity of the data posted (no new IDs, no double IDs etc)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…