动态Form中定义ArrayList对象该如何访问,如何设值?

解决方案 »

  1.   

    访问?
    action中,通过数据库找出值来赋。页面中用struts标签可以显示                                     <logic:present name="allcountry">
                                             <logic:iterate id="co" name="allcountry">
                                                <option value="<bean:write name="co" property="cid"/>"><bean:write name="co" property="cname"/></option>
                                             </logic:iterate>
                                         </logic:present>
      

  2.   

    说错成list的了访问用<%%>的ArrayList l=(ArrayList)ses.getAttribute("selcdt");  //看你是怎么传的了
    l.get(0),(String)l.get(1),(String)l.get(2),(String)l.get(3).../具体取哪个 就看你了设值的一种:            ArrayList l=new ArrayList();
                l.add(0,country);
                l.add(1,province);
                l.add(2,mainindustry);
                l.add(3,subindustry);
                l.add(4,role);都是string的对应上面的传值
                ses.setAttribute("selcdt",l);
      

  3.   

    <%
    通过jsp标记可以达到这种效果
    %>
      

  4.   

    可以先放进Hashtable,然后再构造成Vector,这样也可以啊。。
      

  5.   

    我的意思是从JSP中提交的值怎么放到动态FORM的LIST里啊?
      

  6.   

    l.add(0,country);
                l.add(1,province);
                l.add(2,mainindustry);
                l.add(3,subindustry);
                l.add(4,role);
    ()里面右边的是传来jsp的值,从jsp接受值不用说了吧