处理<html:options> </html:options>

时间:2011-08-23 14:34:22

标签: jsp-tags html-select

在JSP中使用<html:options>动态加载下拉列表时,如何默认选择一个选项?

这是我的代码:

<html:select property="menu" >
    <html:option value="">–SELECT–</html:option>
    <html:options collection="menuList" property="value" labelProperty="label" />
</html:select>

1 个答案:

答案 0 :(得分:0)

您可以像这样指定所选项目:

<html:select property="selectedItem">

您在Action中所要做的就是从Form对象中调用setSelectedItem(“myselection”)。

我假设你在这里使用Struts。

相关问题