• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between a servlet and a bean

 
saahil sinha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know how can a servlet communicate with a bean.Is there any way to do this if yes how?Please help me out require it to be done urgently.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I correctly guess what your question is, the answer is request.getSession().getAttribute("beanName").
- Peter
 
heiner weilandt
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i believe you want to do this:
HttpSession session = request.getSession();
// get bean from session
Bean Bean = (Bean) session.getAttribute("BeanId");
// example to call a getter-method from this bean
String value = AppFormBean.getValue();

hope this help
heiner
 
saahil sinha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope thts not what i intended to do anyways i found out the solution to my problem.Thanx a lot for the reply anyways.
What i intended to do is make my servlet communicate with my ejb for example my ejb will perform creation of accounts n stuff send the response to the servlet and servlet will send the response for output to jsp page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic