I have a HashMap<String, String> in Struts2:
@In(scope=ScopeType.CONVERSATION)
@Out(scope=ScopeType.CONVERSATION)
private Map<String, String> paramMap;
and a String[]:
@In(scope=ScopeType.CONVERSATION)
@Out(scope=ScopeType.CONVERSATION)
private String[] paramsText;
the paramsText is used to store the value of paramMap, and in my jsp, I use <s: iterator> to display the paramMap and paramsText:
<s:iterator value="paramMap" var="param" status="paramsStatus">
<tr>
<td>
<input type="checkbox" key_id="<s:property value="#paramsStatus.index"/>" name="params" value="<s:property value="#param.key"/>"
<s:iterator value="params" var="app">
<s:if test="#app==#param.key">
checked
</s:if>
</s:iterator>/>
 <s:property value="#param.value"/>
</td>
<td>
<input type="text" text_id="<s:property value="#paramsStatus.index"/>" name="paramsText" />
</td>
</tr>
How could the text field show the value stored in the paramsText when the checkbox is checked? I'm thinking about the value property, how should I specify it?
The value in the
paramsTextyou can get while iterating. You need to use<s:set>tag to store the value in the value stack.