<%
   Depts dept=new Depts();
   dept.setId(1);
   dept.setName("技术部");
   Depts dept1=new Depts();
   dept1.setId(2);
   dept1.setName("财务部");
   List<Depts> list=new ArrayList<Depts>();
   list.add(dept);
   list.add(dept1);
   request.setAttribute("dept",dept);
   %>
  <html:select property="id">        //为什么老提示这行Cannot find bean under name org.apache.struts.taglib.html.BEAN    property属性设置的值不是bean里的属性吗
  <html:option value="0">--请选择--</html:option>
  <html:optionsCollection name="dept" value="id" label="name"/>
  </html:select>

解决方案 »

  1.   

      request.setAttribute("dept",dept); 
    ------>request.setAttribute("dept",list);
      

  2.   

    <html:select property="id">   怎么没看到<html:form>标签?
    property对应的是form对应的action,对应的formBean里的属性名称,你找找看formBean里有这个id属性没?
      

  3.   

    <html:select></html:select>  html前缀的标签是struts专用的,用于后面formBean与JSP页面实现数据双向绑定,当你访问该jsp页面时,先实例化后面formBean,把页面里有html标签的property对应上formBean的属性,完成赋值操作,但是找不到该属性,肯定报错,jsp页面无法正常显示