不行,我试过了,为空,因为在两个ActionForm中,它是两个不同的对像来的!

解决方案 »

  1.   

    这样就可以
    class Form1 extends ActionForm{
      private Vector vector1 = null;
      public Vector getVector1(){
         return this.vector1;
      }
      public void setVector1(Vector vector){
         this.vector1 = vector;
      } 
    }
    class Form1 extends ActionForm{
      private Vector vector1 = null;
      public Vector getVector1(){
         return this.vector1;
      }
      public void setVector1(Vector vector){
         this.vector1 = vector;
      } 
    }
    在使用这两个form的时候可以把同一个Vector放入两个里面这样,改变其中任何一个
    ActionForm的Vector都会影响到另一个ActionForm
    不过这样可能要你把两个ActionForm放入session中
    Vector commVec = new Vector();
    Form1 form1 = new Form1();
    form1.setVector1(commVec);
    Form2 = form2 = new Form2();
    form2.setVector2(commVec);
    这样应该就可以。还可以通过使用静态的常量,使用这样的方法在ActionForm不是很好。
      

  2.   

    讲错了,是在两个Action中调有啊,不是在ActionForm中
      

  3.   

    问题解决了,只要在一个DTO中声明为静态的Vector,就OK了,
      

  4.   

    你通过配置文件中的forward把你的vector通过映射到另外一个action中.