Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / May 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Tech_Nazi - 20 May 2008 04:13 GMT
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 will return 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 - 20 May 2008 14:33 GMT
I have know the reason.
Because the class I defined also must Serializable,,
But no body help me ,I have a little say,hehe ~


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.