什么意思,没听懂,能不能把问题描述的在俱体点,]
是不是像这种
ArrayList a=new ArrayList();
String test="this is test";
a.add(test);//把它赋给ArrayList
String b=(String)a.get(0);//把它取出来 

解决方案 »

  1.   

    Vector aa=new Vector();
            String str="this is test";
            aa.add(str);
            System.out.println((String)aa.get(0));这样也行
      

  2.   

    一个变量干吗要赋值给一个数组?你需要的到底是什么?如果只是参数,可以用setParameter(),如果是对象可以setArtibute()
      

  3.   

    Servlet :
    String username = "pleonheart";
    ArrayList arrayList = new ArrayList();
    arrayList.add(username);
    request.setAttribute("arrayList", arrayList);
    request.getRequestDispatcher("xxx.jsp").forword(request, response);jsp :
    ArrayList arrayList = null;
    if (request.getAttribute("arrayList") != null)
      arrayList = (ArrayList)request.getAttribute("arrayList");
    //display elements in ArrayList
    for (int i = 0, size = arrayList.size(); i < size; i++)
      System.out.println("username : " + (String)arrayList.get(i));