Re: How to re-use a request scope bean?
Joe, I still haven't had a chance to try this yet, but I wanted to let you know that this seems like the right way to go and I appreciate the suggestion. - Todd Chaffee At 02:02 PM 03/21/01 -0800, you wrote: > > The ideal would be for me to be able to pass the existing request's bean >to > > the new request. Is this possible? > >Short of trying to serialize the object and encode it into the URLs on the >page, I don't know of a way of getting a request-scope object to survive >outside of the scope of the request (go figure!). > >I think my first try would be to write a "container" bean that would hold >all search results (either in the application scope or the session scope). >Whenever someone wanted a new search, the search container would handle the >process of making a new SearchResults object and it would merely pass back >some identifier that you could use to get it later: > > class="mypackage.SearchManager"/> > > property="newsearch" arg="hot teenage lesbian sluts" >class="mypackage.SearchResults"/> > > > > >Then, in your product_list.jsp, you'd have something to recall the results >based on their ID something like: > > class="mypackage.SearchManager"/> > > property="existingsearch" arg="<%= request.getParameter(\"searchid\") %>" >class="mypackage.SearchResults"/> > >Let me know if this helps, > >- Joe
RE: How to re-use a request scope bean?
Title: RE: How to re-use a request scope bean? I do not know if this would be useful but RequestDispatcher does preserve the original Request and I assume you are doing that to forward request. May be you can use session scope and try synchronizing on session. Gary -Original Message- From: Todd Chaffee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 21, 2001 11:15 AM To: [EMAIL PROTECTED] Subject: How to re-use a request scope bean? I have a JSP app whose call sequence goes like this: 1) Form calls search_results.jsp with form values. 2) search_results.jsp uses to declare a Vector object and loads the vector with a list of objects and then does a to product_list.jsp. 3) product_list uses to declare the same Vector object and displays some of the objects in the Vector. The question is, I would like to have product_list.jsp call itself to display the next page of objects in the Vector. When I send a request to the product_list.jsp a second time, the Vector declared in product_list.jsp is new and empty. I think this is because it is a new request and the Vector bean has only request scope. If I try to use session scope I get problems with multiple browser windows being open to the product_list.jsp page. Since the bean is shared, the two browser windows will update the same bean which is not acceptable. The ideal would be for me to be able to pass the existing request's bean to the new request. Is this possible? I am using Tomcat version 3.2? (how can I determine Tomcat's version?) and Apache version 1.3.12 on Redhat Linux version 6.2. My jsp source files can be provided if need be. Thank you, Todd Chaffee
Re: How to re-use a request scope bean?
> The ideal would be for me to be able to pass the existing request's bean to > the new request. Is this possible? Short of trying to serialize the object and encode it into the URLs on the page, I don't know of a way of getting a request-scope object to survive outside of the scope of the request (go figure!). I think my first try would be to write a "container" bean that would hold all search results (either in the application scope or the session scope). Whenever someone wanted a new search, the search container would handle the process of making a new SearchResults object and it would merely pass back some identifier that you could use to get it later: Then, in your product_list.jsp, you'd have something to recall the results based on their ID something like: " class="mypackage.SearchResults"/> Let me know if this helps, - Joe
How to re-use a request scope bean?
I have a JSP app whose call sequence goes like this: 1) Form calls search_results.jsp with form values. 2) search_results.jsp uses to declare a Vector object and loads the vector with a list of objects and then does a to product_list.jsp. 3) product_list uses to declare the same Vector object and displays some of the objects in the Vector. The question is, I would like to have product_list.jsp call itself to display the next page of objects in the Vector. When I send a request to the product_list.jsp a second time, the Vector declared in product_list.jsp is new and empty. I think this is because it is a new request and the Vector bean has only request scope. If I try to use session scope I get problems with multiple browser windows being open to the product_list.jsp page. Since the bean is shared, the two browser windows will update the same bean which is not acceptable. The ideal would be for me to be able to pass the existing request's bean to the new request. Is this possible? I am using Tomcat version 3.2? (how can I determine Tomcat's version?) and Apache version 1.3.12 on Redhat Linux version 6.2. My jsp source files can be provided if need be. Thank you, Todd Chaffee