Why jsp can't get the Vector fill with user-defined class by theRemote interface?

Discussion in 'Java' started by Realove, May 20, 2008.

  1. Realove

    Realove Guest

    Because It is a big project so i provide a model to express my
    question,
    Qestion is:I want get the Vector full fill with the a Object in Jsp.
    but I can't get it,There will problem when test return,but we I
    Choose String but no class a 's object ,It can be return
    successful.It
    seems that jsp Can't recognize the class a,,but I really include the
    Ejb module in jsp's lib.and editor alse prompt a's information.
    I alse test it in JBoss server It alse occur Exception!
    I cant understand why,
    so come to here ask why?Please help me,3ks very much!!!

    ---------------------------------------------------------------------------­-------------------------
    I use Netbean 6.1,Glassfish.Ejb3
    import javax.ejb.Stateless;


    1.
    @Stateless(mappedName="T")
    public class vectorBean implements vectorRemote {
    //Vector v;
    //@PostConstruct
    //public void Init(){v=new Vector}


    public Vector test(){
    Vector v=new Vector();
    v.add(new a("alex",14));
    return v; }
    }


    2. a is a simple class
    public class a {
    public String m;
    public int n;


    public a(String m, int n) {
    this.m = m;
    this.n = n;
    }
    getter,and setters!



    }


    3.Jsp
    InitialContext ctx=new InitialContext();
    //ShoppingCartRemote
    s=(ShoppingCartRemote)ctx.lookup("shopcart");
    vectorRemote s=(vectorRemote)ctx.lookup("T");
    Vector v=s.test();
    Enumeration e=v.elements();
    while(e.hasMoreElements()){
    a p=(a)e.nextElement();
    out.println(p.m);
    }
     
    Realove, May 20, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,071
    Smokey Grindel
    Dec 2, 2006
  2. Oodini
    Replies:
    1
    Views:
    1,795
    Keith Thompson
    Sep 27, 2005
  3. Replies:
    8
    Views:
    1,960
    Csaba
    Feb 18, 2006
  4. eb
    Replies:
    2
    Views:
    399
    Earl Purple
    Sep 13, 2006
  5. Realove
    Replies:
    0
    Views:
    456
    Realove
    May 20, 2008
Loading...

Share This Page