我这个是百分百好使的   记得要给分数啊     首先在action中这样写
try{
conn=ds.getConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery( "select   invclassname,pk_invcl   from   bd_invcl   where   pk_corp= ' "+pk_corp+ " ' ");
while(rs.next()){
wzlb=new   wuzileibie();
wzlb.setKey(rs.getString(1));
wzlb.setValue(rs.getString(2)+ "_ "+rs.getString(1));
list.add(wzlb);
}
request.setAttribute( "wuzileibie_list ",   list);
把一个你要填充的放在bean里   然后把bean放在list里,然后在把list放在request里
然后jsp页面这样
---------------------------------------------------------------------
物资类别: <select   name= "wuzileibie "   style= "width:180px; ">
<option> </option>
<logic:iterate   id= "wzlb "   name= "wuzileibie_list ">
<bean:define   id= "aa "   name= "wzlb "   property= "value "/>
<option   value= <%=aa%> >
<bean:write   name= "wzlb "   property= "key "/>                                                                                                                                                            
</option>
</logic:iterate>
</select>
</logic:present> 
用到了逻辑标签,自定义标签,然后用的是html的select表转标签,虽然代码不标准,但是我觉得好用,
而且在做一些操作的时候很容易根据定义的变量做出一些特殊的选择,自己琢磨吧

解决方案 »

  1.   

    try{ 
    conn=ds.getConnection(); 
    stmt=conn.createStatement(); 
    rs=stmt.executeQuery( "select  invclassname,pk_invcl  from  bd_invcl  where  pk_corp= ' "+pk_corp+ " ' "); 
    while(rs.next()){ 
    wzlb=new  wuzileibie(); 
    wzlb.setKey(rs.getString(1)); 
    wzlb.setValue(rs.getString(2)+ "_ "+rs.getString(1)); 
    list.add(wzlb); 

    request.setAttribute( "wuzileibie_list ",  list); 
    把一个你要填充的放在bean里  然后把bean放在list里,然后在把list放在request里 
    然后jsp页面这样 
    --------------------------------------------------------------------- 
    物资类别: <select  name= "wuzileibie "  style= "width:180px; "> 
    <option> </option> 
    <logic:iterate  id= "wzlb "  name= "wuzileibie_list "> 
    <bean:define  id= "aa "  name= "wzlb "  property= "value "/> 
    <option  value= <%=aa%> > 
    <bean:write  name= "wzlb "  property= "key "/>                                                                                                                                                            
    </option> 
    </logic:iterate> 
    </select> 
    </logic:present>