You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Kies <da...@gmail.com> on 2005/06/07 20:37:39 UTC

Cannot find bean in any scope

Greetings.  Here is my problem:
index.jsp does a redirect to my action.
action loads a bean with data
forwards to x.jsp

x.jsp looks fine, data comes up fine.

I do a refresh.  I get Cannot find bean in any scope.  The first time
i have data with no problems because the action class loads the
request with the bean w\data.

The second time the bean is not in the request since i am calling the
jsp directly (through the refresh).

Question:
1) What is a simple way to fix this?
2) I thought the request kept the data in it for a refresh.  Is this wrong?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cannot find bean in any scope

Posted by Dave Newton <ne...@pingsite.com>.
Daniel Kies wrote:

>index.jsp does a redirect to my action.
>action loads a bean with data
>forwards to x.jsp
>
>x.jsp looks fine, data comes up fine.
>
>I do a refresh.  I get Cannot find bean in any scope.  The first time
>i have data with no problems because the action class loads the
>request with the bean w\data.
>
>The second time the bean is not in the request since i am calling the
>jsp directly (through the refresh).
>
>Question:
>1) What is a simple way to fix this?
>  
>
1) Put the bean in session (not _my_ preferred solution).

2) Forward (not redirect) to the JSP, so when you refresh you're 
refreshing the action, not the JSP. This also separates the user from 
the JSP (which in struts folks tend to put under WEB-INF so you can't 
get at them from the browser, except for some welcome files).

>2) I thought the request kept the data in it for a refresh.  Is this wrong?
>  
>
Apparently ;)

Yes, that's wrong: A refresh is just a new request to the current URL.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cannot find bean in any scope

Posted by Dave Newton <ne...@pingsite.com>.
Daniel Kies wrote:

>If I forward to the jsp via an action, how do I make it so when the
>jsp refreshes it hits the action?
>  
>
The URL will show the URL of the action, not the JSP. When you refresh 
it's refreshing the action, which will again forward to the JSP.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cannot find bean in any scope

Posted by Daniel Kies <da...@gmail.com>.
If I forward to the jsp via an action, how do I make it so when the
jsp refreshes it hits the action?

On 6/7/05, Michael Jouravlev <jm...@gmail.com> wrote:
> On 6/7/05, Daniel Kies <da...@gmail.com> wrote:
> > Greetings.  Here is my problem:
> > index.jsp does a redirect to my action.
> > action loads a bean with data
> > forwards to x.jsp
> >
> > x.jsp looks fine, data comes up fine.
> >
> > I do a refresh.  I get Cannot find bean in any scope.  The first time
> > i have data with no problems because the action class loads the
> > request with the bean w\data.
> >
> > The second time the bean is not in the request since i am calling the
> > jsp directly (through the refresh).
> 
> Do you redirect or forward to x.jsp? If you redirect, you lose beans
> with scope less than session.
> 
> > Question:
> > 1) What is a simple way to fix this?
> 
> Either store bean in session, or forward to jsp through action. Thus,
> you actually would be reloading action.
> 
> > 2) I thought the request kept the data in it for a refresh.  Is this wrong?
> 
> yep, this is wrong.
> 
> Michael.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cannot find bean in any scope

Posted by Michael Jouravlev <jm...@gmail.com>.
On 6/7/05, Daniel Kies <da...@gmail.com> wrote:
> Greetings.  Here is my problem:
> index.jsp does a redirect to my action.
> action loads a bean with data
> forwards to x.jsp
> 
> x.jsp looks fine, data comes up fine.
> 
> I do a refresh.  I get Cannot find bean in any scope.  The first time
> i have data with no problems because the action class loads the
> request with the bean w\data.
> 
> The second time the bean is not in the request since i am calling the
> jsp directly (through the refresh).

Do you redirect or forward to x.jsp? If you redirect, you lose beans
with scope less than session.

> Question:
> 1) What is a simple way to fix this?

Either store bean in session, or forward to jsp through action. Thus,
you actually would be reloading action.

> 2) I thought the request kept the data in it for a refresh.  Is this wrong?

yep, this is wrong.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org