标签没用对吧,我的方法是吧几个选项放在collection中。例如:
<html:select property="beanCollectionSelect">
   <html:optionsCollection name="testForm" 
                           property="beanCollection"/>
</html:select>beanCollectionSelect是form里string型的属性,代表所选项
beanCollection是form里Collection型熟悉,代表供选择的选项集合
beanCollection这样赋值:
 Vector entries = new Vector(10);
 entries.add(new LabelValueBean(“Delivery”,“a”));
 entries.add(new LabelValueBean(“Pickup”,“b”));
 beanCollection=entries;
这样,beanCollectionSelect的值就是“a”或“b”应该是解决你的问题的一种方法

解决方案 »

  1.   

    你必须有form类,和action类,form类中还有type这个变量,也就是说要把东西写全了
      

  2.   

    <html:select property ="type">
    这种写法就是说默认从formbean里去取东西.那么你这个语句就必须包含在
    <html:form >和</html:form >之间
      

  3.   

    泛泛地谈一下如何用好html;select这个标签:一般使用select时,都有两个属性,一个是value,一个label;
    我们可以自定义一个javabean,它包含这两个属性,也可以用struts提供的ValueLabelBean;当我们在程序里对数据库里某张表进行查询后得到一个ResultSet,
    我们一般会对这个ResultSet中的数据进行提取,并把它们保存到上面提到的javaben或ValueLabelBean里;并形成一个类似Vector 或Collection的对象;
    然后,我们把这个Vector或Collection放到request里,如:
    request.setAttribute ("myVector", myVector);然后,返回jsp,
    在jsp里使用:
    <html:select name="YourFormName" property="yourCurrentValue">
              <html:options collection ="myVector" property="yourValue" labelProperty="yourLabel"/>
              </html:select>这样,struts就会正确显示你当前使用的value值,并在下拉框里显示对应的值。
    不过,一般常会犯这样的错误,
    也就是你要注意,
    yourCurrentValue要在yourValue里存在,,,,
    ok?
      

  4.   

    可以不使用struts的标签,直接使用html的select ,这样多省事阿