Change the scope of the bean from 'page' to 'request' or 'session', and in
the servlet store the bean in the appropriate place (request or session) by
using 'setAttribute("foo", beanRef),
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Mark Wade
> Sent: 07 March 2000 22:16
> To: [EMAIL PROTECTED]
> Subject: a particular bean
>
>
> Hi,
>
> Environment = winnt4 sp6 tomcat3.0
>
> I'm using a servlet to access a database, create a bean and populate the
> bean's fields with the returned data. The question is, how do I
> access that
> particular bean?
>
> In the .jsp:
>
> <jsp:useBean id="foo" scope="page" beanName="package.name.DataBean"
> type="package.name.DataBean">
> </jsp:useBean>
>
> The above looks for a file ..\package\name\DataBean.ser ... and
> finds one if
> I...
>
> ObjectOutputStream out = new ObjectOutputStream(new
> FileOutputStream(SERPATH));
> out.writeObject(tbean);
> response.sendRedirect(DOCPATH + "foo.jsp");
>
> ... but writing the serialized bean out to disk so I can access it with
> type= is exceedingly sad :(
>
> I'm holding a reference to the bean in the servlet so how do I
> have the .jsp
> access the loaded servlet's getDataBean() method and access my populated
> bean?
>
> Thanks for any and all help :)
>
> -- Mark Wade
>
> ==================================================================
> =========
> 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