Hello,
I do it as follows:
1- Instantiate the bean in the servlet
2- Set it in the request, logical name must match the ID field in the
<jsp:useBean ID> tag
3- Include the target jsp, (forward may not be possible)
// in the Servlet
TodayInfo todayInfo = new TodayInfo(); request.setAttribute("today",
todayInfo);
getServletConfig().getServletContext().getRequestDispatcher("/jsp/TopSummary.jsp").include(request,
response);
// in the JSP page
<jsp:useBean id="today" class="measureBeans.TodayInfo" scope="request"/>
I hope it helps
Bulent
>From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: creating java beans with scope=request in servlets
>Date: Wed, 26 Apr 2000 14:01:02 -0700
>
>Aureliano Calvo wrote:
>
> > Hi,
> > Is there any way of creating java beans with scope=request in a servlet,
>so
> > that I can then redirect to a JSP? I want to pass objects from a servlet
>to
> > a JSP, but without using the session. I know this can be done with the
> > RequestDispatcher, but the url in the browser remains as the servlet.
> > Thanks,
> >
>
>If you do a redirect to a JSP, instead of a forward, you are asking the
>browser to
>send a *second* request (plus paying the time price for the extra round
>trip across
>the network). Thus, anything you want to pass to the JSP page will need to
>be a
>session attribute instead of a request attribute. Request attributes work
>with
>RequestDispatcher.forward() because it is the *same* request.
>
>IMHO, the "location" shown in a browser is totally irrelevant in a web
>application,
>as opposed to when you are browsing a web site. If it bothers you (or your
>users),
>run the main part of your app inside a frame (or use Javascript to open a
>window
>with no location bar) to make the URLs invisible.
>
> >
>Aureliano Calvo
> >
>
>Craig McClanahan
>
>===========================================================================
>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
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
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