原来我用bean在jsp中实现的:
<SELECT NAME="sex">
<%dispclass disp=new dispclass();
Vector allclass=new Vector();
allclass=disp.dispall();
for(int i=0;i<allclass.size();i++)
{
String sex=(String)allclass.elementAt(i);
%>
<option><%=sex%></option><%}
%>
</select>
<SELECT NAME="sex">
<%dispclass disp=new dispclass();
Vector allclass=new Vector();
allclass=disp.dispall();
for(int i=0;i<allclass.size();i++)
{
String sex=(String)allclass.elementAt(i);
%>
<option><%=sex%></option><%}
%>
</select>
<td>
<html:select property="groupId">
<html:optionsCollection property="groups" label="groupName" value="groupId"/>
</html:select>
</td>
其中我的actionform为两个属性,groupId,groups。其中groups里就是包含了option里要显示的数据对象集合(Collection),每象有两个属性,分别为groupId,和groupName。我认为这是一种比较合理的实现当前你也可以能过html:options标志来实现option。