如何在变量中设置迭代器或选项标记的值,并使用struts html传递给隐藏变量
<select name="trackNo" id="trackNo" style = "font-family: verdana; font-size: 14px; font-weight: bold; background-color: #b4a71b; color: #000; text-transform: uppercase;height:25px;width:405px;" >
<option value="">--Select--</option>
<s:iterator value = "#session.purchaseOrderList.entrySet()" var = "entry" status="rowstatus">
<option value="<s:property default = '--' value = '#entry.value.trackNo'/>"><s:property default = "--" value = "#entry.value.trackNo"/> - <s:property default = "--" value = "#entry.value.referenceNo"/></option>
</s:iterator>
<s:set var="option_list" scope="request" value="#entry"/>
<s:hidden id='myhidden' name='myhidden' value='%option_list'/>
</select>
答案 0 :(得分:0)
愿这段代码对您有所帮助。
<select name="trackNo" id="trackNo" style = "font-family: verdana; font-size: 14px; font-weight: bold; background-color: #b4a71b; color: #000; text-transform: uppercase;height:25px;width:405px;" >
<option value="">--Select--</option>
<s:iterator value = "#session.purchaseOrderList.entrySet()" var = "entry" status="rowstatus">
<option value="<s:property default = '--' value = '#entry.value.trackNo'/>">
<s:property default = "--" value = "#entry.value.trackNo"/> - <s:property default = "--" value = "#entry.value.referenceNo"/>
</option>
<s:set var="option_list" scope="request" value="#entry"/>
<s:hidden id='myhidden_{%rowstatus}' name='myhidden[]' value='%option_list'/>
</s:iterator>
</select>