aspose file tools*
The moose likes Servlets and the fly likes Calling java bean in a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling java bean in a Servlet" Watch "Calling java bean in a Servlet" New topic
Author

Calling java bean in a Servlet

Neha Kotha
Greenhorn

Joined: Jun 14, 2005
Posts: 5
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

Joined: Jan 30, 2000
Posts: 3222
    
    5
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...)


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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...)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling java bean in a Servlet