tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jann VanOver <Jann.VanO...@loudeye.com>
Subject RE: "request.getAttribute()" problems
Date Fri, 20 Jul 2001 20:52:43 GMT
Then the bean must be in the SESSION scope

Putting it in the REQUEST scope means -- "keep it around with this request"

When you go to a new JSP page you usually get a new request to go with it.

-----Original Message-----
From: Paul Kofon [mailto:pkofon@hotmail.com]
Sent: Friday, July 20, 2001 11:05 AM
To: tomcat-user@jakarta.apache.org
Subject: Re: "request.getAttribute()" problems


Hi David,

On the first page, I've got a form with an action pointing to a certain jsp 
page. It's on this page (the one pointed to in the action statement) that I 
try to retrieve the object. Does that make any sense?

Regards,

Paul


>From: David Haraburda <david@haraburda.com>
>Reply-To: tomcat-user@jakarta.apache.org
>To: tomcat-user@jakarta.apache.org
>Subject: Re: "request.getAttribute()" problems
>Date: Fri, 20 Jul 2001 12:56:33 -0500
>
>When you say "next page", what do you mean?  How are you going from the 
>first
>page to the second page?  This is important because if you are doing it a
>certain way (such as a response.sendRedirect) your request object won't get
>passed along...
>
>David
>
>Paul Kofon wrote:
>
> > Hi all,
> >
> > I have a Bean whose scope I would like to set to "request". I would like

>to
> > retrieve this Bean's instance when the next page is requested.
> > On the first page, I have:
> >
> > < jsp:useBean id="beanclass" class="BeanClass" scope="request" />
> >
> > On the next page, I have:
> >
> > BeanClass b = (BeanClass) request.getAttribute("beanclass");
> >
> > However, when I try to use instance "b" of my Bean,  I get a
> > NullPointerException. The strange thing is that the code seemed to 
>working
> > in Orion. Is there something I'm doing wrong?
> > Note that I can use the instance without errors when I set the scope to
> > "session" and use "session.getAttribute()" instead but I don't want to 
>do
> > this as my instance should only last for a request.
> > I'm using Tomcat 3.2.2/Sun's JDK 1.3.1 on Win2K Pro.
> >
> > Regards,
> >
> > Paul
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at 
>http://explorer.msn.com/intl.asp
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Mime
View raw message