I believe I can be done through session. Create a session in Servlet and
assign your bean instant to it. Here is the example.


MyBeanClass beanObj = new MyBeanClass();

HttpSession session = request.getSession(true);
session.putValue("MyBean", beanObj);

In JSP page follow the steps to get it out.

// Get session object first.
 HttpSession session = req.getSession(false);
if(session == null)
{
     out.println("No session found. ");
     return null;
}

 // Get the bean instance from the session.
MyBeanClass  beanInstance = (MyBeanClass)session.getValue("MyBean ");

I hope this helps.

Thanks,
Saru
----Original Message-----
From:   Karl Roberts [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, August 02, 2000 1:24 PM
To:     [EMAIL PROTECTED]
Subject:        request scope for bean from servlet

Hi All,

        Does any one know how to pass a bean into a JSP with a request scope
from a servlet so that the bean is not re-instanciated (because it already
exists in the request).

thanks in advance

Karl

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to