0

我正在使用下拉选项集合来选择一组值。

<html:select property="cddSourceOfFunds" styleId="cddSourceOfFunds" styleClass="selectDefault" onchange="return mtmrsValRequiredselect(this.id,'selectDefault','selectDefault errorBdr','errorSpan1','0')">
                        <logic:present name="sourceOfFundsList" scope="request">
                            <html:option value="0">
                                <bean:message key="mtmrs.validation.select" />
                            </html:option>
                            <html:optionsCollection name="sourceOfFundsList" label="value"
                                value="value" />
                        </logic:present>
                        <logic:notPresent name="sourceOfFundsList" scope="request">
                            <html:option value="0">
                                <bean:message key="mtmrs.validation.select" />
                            </html:option>
                        </logic:notPresent>

我将 cddSourceOfFunds 的值设置为 action 表单并返回到 jsp。但是下拉列表仍然显示没有发送数据.. 即“选择”作为默认值。但是,我可以使用在表单中写入属性值

<bean:write name = "/remittanceTransactionCdd" property ="cddSourceOfFunds" />

我希望下拉菜单在加载时显示我从操作方法设置的默认值。属性值在表单中。但无法在下拉列表中显示。我该如何实现它。帮助赞赏。

4

1 回答 1

0

由于您使用逻辑迭代来加载列表框中的项目,因此您面临问题选项 1. 在加载时使用 jquery 或 javascript 设置列表框的值使用 jstl 访问表单数据,这将在请求范围内可用2. 或者使用 html:options http://www.coderanch.com/t/57329/Struts/populate-html-select-options-struts代替使用逻辑迭代器迭代列表

于 2013-04-16T12:14:33.600 回答