• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling java bean from servlet

 
saahil sinha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know how one calls a java bean not an ejb from a servlet
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by saahil sinha:
Hi,
I would like to know how one calls a java bean not an ejb from a servlet

Calling a javabean from a servlet is like calling a class from java program. Create an instance of the javabean in the servlet and start accessing its methods.
Person p = new Person();
p.setName("foo");
p.getName();
...
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's a bean you've put into session from a jsp page or something, just get it out of session as an object and cast to whatever ADT it is. Just like you would anything else.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!