Thanks, I used the findAttribute and it worked.
-Pete
On Thu, 01 Jun 2000, you wrote:
> Pete Walsh wrote:
>
> > Hi,
> >
> > I'm try to get a reference to one of my beans inside the code of a Jsp Tag I'm
> > making. When I declare the bean's scope to be page, and use the following
> > statement in my Tag's doStartTag
> >
> > BeanName log = (BeanName)pageContext.getAttribute("BeanName");
> > (where BeanName is the name of the bean ;)
> >
> > everything is ok., but my bean is supposed to have a scope of application. So
> > when I switch it to application, and use that line, log is null. So how can I
> > get this object? I guessed that maybe applicationContext.getAttribute would
> > work but it does not. Thanks.
> >
>
> You've got a couple of choices:
>
> * Use the findAttribute() method instead of getAttribute(), which looks in
> progressively larger scopes until it locates the bean.
>
> * Explicitly declare which scope you want with a second argument:
>
> BeanName log = (BeanName) pageContext.getAttribute("BeanName",
> PageContext.APPLICATION_SCOPE);
>
> See the Javadocs for PageContext for more information.
>
> >
> > Pete Walsh
> >
>
> 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
--
===========================================================================
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