如何在变量中设置迭代值并在struts中传入隐藏变量?

时间:2017-07-21 10:04:27

标签: html struts2

如何在变量中设置迭代器或选项标记的值,并使用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>

1 个答案:

答案 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>