Requests are not preserved over a redirect because this generates a redirect
response back to the browser. The browser responds by requesting the URL provided
in the redirect response.
Request and response objects are preserved over forward because this is internal
to the webserver.
-- Jason
James Howe wrote:
>
> I have two JSP pages which I want to have share a bean. In the first JSP
> page I do something like this:
>
> [...]
> <jsp:useBean id="bean" scope="request" class="package.BeanClass"/>
> <jsp:setProperty name="bean" property="prop" value='Some Value'/>
> <logic:redirect href="foo.jsp"/>
> [...]
>
> In "foo.jsp", I have code which looks like this:
>
> [...]
> <logic:notPresent name="bean" scope="request">
> <h3>Message not available</h3>
> </logic:notPresent>
> <logic:present name="bean" scope="request">
> <jsp:useBean id="bean" scope="request" class="package.BeanClass"/>
> <h3><bean:write name="bean" property="prop" filter="true"/></h3>
> </logic:present>
> [...]
>
> When I invoke the first page, I make the transition to the second page, but
> the bean property is never found. I've debugged the code and it appears
> that the request object used by the second page does not have the attribute
> defined by the first page. I guess I thought that objects put into the
> request scope were maintained across a redirection. Was I wrong or am I
> just doing something stupid?
>
> Thanks.