gpt4 book ai didi

java - 在 Struts2 select 标签中再添加一个选项字段

转载 作者:行者123 更新时间:2023-11-30 03:55:03 24 4
gpt4 key购买 nike

我有一个 struts 2 select 标签,如下所示。

<s:select list="myList" listKey="myListVal"  listValue="myListDesc"></s:select>

渲染如下

<select data-inputs="myListInput" >
<option value="myListVal1" >myListDesc1</option>
<option value="myListVal2" >myListDesc2</option>
<option value="myListVal3" >myListDesc3</option>
</select>

我想再添加一个值为空的选项字段

<option value="" ></option>

到选项字段并在列表中进行修改。

在 struts 1 中,可能如下所示

<html:option value=""></html:option>

这样在struts 2中可能吗

note:i couldn't able to modifiy the list before the page load in the java

最佳答案

select 标签中有一个名为 emptyOption 的属性。它的工作原理如下。

<s:select list="myList" listKey="myListVal"  listValue="myListDesc" emptyOption="true"  ></s:select> 

关于java - 在 Struts2 select 标签中再添加一个选项字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23440767/

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