This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Communication between a servlet and a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between a servlet and a bean" Watch "Communication between a servlet and a bean" New topic
Author

Communication between a servlet and a bean

saahil sinha
Ranch Hand

Joined: Apr 07, 2003
Posts: 68
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

Joined: Apr 20, 2000
Posts: 3252
If I correctly guess what your question is, the answer is request.getSession().getAttribute("beanName").
- Peter
heiner weilandt
Ranch Hand

Joined: Sep 10, 2002
Posts: 46
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

Joined: Apr 07, 2003
Posts: 68
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between a servlet and a bean
 
Similar Threads
Servlet init parameter from JSP ?
Servlets
How to make DNS
how to make servlet local?
Threadsafe?