gpt4 book ai didi

java - Struts 2 迭代选择中的空顶部选项

转载 作者:行者123 更新时间:2023-12-01 21:37:29 25 4
gpt4 key购买 nike

有没有办法在以下内容中添加“空顶部选择”选项:

<select id="OrderNameIssueId" name="OrderWork.OrderNameIssueId" style="width: auto">
<s:iterator value="OrderWork.ClientOrderNameIssues" status="rowIdx" id="ClientIssueOption">
<option value='<s:property value="#ClientIssueOption.OrderNameIssue.OrderNameIssueId"/>' <s:if test="OrderWork.OrderNameIssueId != null && (OrderWork.OrderNameIssueId == #ClientIssueOption.OrderNameIssue.OrderNameIssueId)">selected</s:if><s:else></s:else>>
<s:property value="#ClientIssueOption.OrderNameIssue.issueDescription"/>
<s:if test="#ClientIssueOption.ApprovedOption == true">&nbsp;|&nbsp;Approved</s:if>
<s:else>
<s:if test="#ClientIssueOption.RequireFix == true">&nbsp;|&nbsp;Requires Fix</s:if>
<s:else>&#9;|&nbsp;Unapproved</s:else>
</s:else>
&nbsp;|&nbsp;Format:&nbsp;<s:property value="#ClientIssueOption.OrderNameIssue.issueHint"/>
</option>
</s:iterator>
</select>

它位于使用 Struts 2 的 JSP 页面上。选择本身可以工作,但是我们需要有一个选项会显示在页面上,如下所示:

<option value="0">--</option>

最佳答案

您应该能够将其添加到“select”下方和“s:iterator”上方。您还需要在选择时指定。

<select id="OrderNameIssueId" name="OrderWork.OrderNameIssueId" style="width: auto">
<s:if test="OrderWork.OrderNameIssueId == null || OrderWork.OrderNameIssueId == 0">
<option value="0" selected>--Please select an option--</option>
</s:if>
<s:else>
<option value="0">--Please select an option--</option>
</s:else>
<s:iterator value="OrderWork.ClientOrderNameIssues" status="rowIdx" id="ClientIssueOption">
<option value='<s:property value="#ClientIssueOption.OrderNameIssue.OrderNameIssueId"/>' <s:if test="OrderWork.OrderNameIssueId != null && (OrderWork.OrderNameIssueId == #ClientIssueOption.OrderNameIssue.OrderNameIssueId)">selected</s:if><s:else></s:else>>
<s:property value="#ClientIssueOption.OrderNameIssue.issueDescription"/>
<s:if test="#ClientIssueOption.ApprovedOption == true">&nbsp;|&nbsp;Approved</s:if>
<s:else>
<s:if test="#ClientIssueOption.RequireFix == true">&nbsp;|&nbsp;Requires Fix</s:if>
<s:else>&#9;|&nbsp;Unapproved</s:else>
</s:else>
&nbsp;|&nbsp;Format:&nbsp;<s:property value="#ClientIssueOption.OrderNameIssue.issueHint"/>
</option>
</s:iterator>
</select>

关于java - Struts 2 迭代选择中的空顶部选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36803640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com