2011-08-23 48 views
0

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

这里是我的代码:

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

您在那里使用的不仅仅是JSP。 –

回答

0

您可以指定所选择的项目是这样的:

<html:select property="selectedItem"> 

所有你在你的动作做的是调用setSelectedItem(“myselection”)从您的表单对象。

我假设你在这里使用Struts。