File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling java bean in a Servlet

 
Neha Kotha
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I have one question, is it possible to call a JAVA BEAN in a servlet if so how to do that.I would be very glad if anybody can give me the answer.
Bye
Haeika.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling a JavaBean from a Servlet is just like using other non-bean classes. Assume that AccountInfo is a bean that accesses the enterprise DB and gets the info associated with a username...
AccountInfo accInfo = new AccountInfo(username);
String firstName = accInfo.getFirstName();
String lastName = accInfo.getLastName();
Address addr = accInfo.getAddress();
(The Address class is one defined by the developer...)
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Thank u
Harika
Originally posted by Tony Alicea:
Calling a JavaBean from a Servlet is just like using other non-bean classes. Assume that AccountInfo is a bean that accesses the enterprise DB and gets the info associated with a username...
AccountInfo accInfo = new AccountInfo(username);
String firstName = accInfo.getFirstName();
String lastName = accInfo.getLastName();
Address addr = accInfo.getAddress();
(The Address class is one defined by the developer...)

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic