自己迭代并且判断当前选中的option是哪项
等于再写一次这个类型的标签,

解决方案 »

  1.   

    比如随便写个select都要form bean ,不写就不行
    <html:select property="a">
     <html:option value="password">1</html:option>
      <html:option value="key">2</html:option>
      </html:select>
      

  2.   

    呵呵,想到用bean来处理已经是个好现象了,
    给你一个大概的结构吧。public class SelectTag implements FormTag{
        private LinkedHashMap <String, String>options= new LinkedHashMap <String, String>();
        private String name;
        private String value;
        private String errWord;    public SelectTag (LinkedHashMap <String, String>options , String name){
        ......
        }    /*从sql中生成options,第一个字段为value,第二个字段为show*/
        public SelectTag (String sql, Connection conn ,String name){
             ......
        }    public String getHtmlOut(){
             ......
        }    public void setValue(String value){
            ......
        }
     
        //从request中得到值并做简单测试,通过为true,未通过则在getErr()中得到错误信息
        public boolean getAndTestValue(HttpServletRequest request){
            .......
        }    public String getErr(){
            .......
        }    public String getValue(){
            .......
        }
    }
      

  3.   

    楼上说什么,没看明白啊
    我是说,在页面中要用select,怎么都要为这页写个form bean "SelectForm"?
    <html:select property="id" name="SelectForm">
      <html:options collection="Names" property="id"
                       labelProperty="displayName"/>
    </html:select>而我在struts中都没用form bean,都是直接通过request取值的
    我现在想的是怎么不写form bean,就可以用<html:select>?
      

  4.   

    不写的话,怎么用?还有通过request.getParameter("下拉框name");
    这“下拉框name”在哪里定义?