tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Chaffee ...@toddbiz.com>
Subject Re: How to re-use a request scope bean?
Date Mon, 02 Apr 2001 16:28:31 GMT
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:
>
>   <jsp:useBean id="searchmanager" scope="session"
>class="mypackage.SearchManager"/>
>
>   <ora:useProperty id="mysearchresults" name="searchmanager"
>property="newsearch" arg="hot teenage lesbian sluts"
>class="mypackage.SearchResults"/>
>   <!-- useProperty is a tag that appears in O'Reilly's "Javaserver Pages".
>It's for beans that can return other beans as properties. In this case, the
>searchmanager.getNewsearch(String arg) method returns an object of type
>mypackage.SearchResults. useProperty calls this method and assigns the
>returned bean to "mysearchresults". You can probably download O'Reilly's
>implementation of useProperty, or you can brew your own. -->
>
>   <jsp:forward page="product_list.jsp?searchid=<%= mysearchresults.getId()
>%>" \>
>
>Then, in your product_list.jsp, you'd have something to recall the results
>based on their ID.... something like:
>
>   <jsp:useBean id="searchmanager" scope="session"
>class="mypackage.SearchManager"/>
>
>   <ora:useProperty id="mysearchresults" name="searchmanager"
>property="existingsearch" arg="<%= request.getParameter(\"searchid\") %>"
>class="mypackage.SearchResults"/>
>
>Let me know if this helps,
>
>- Joe


Mime
View raw message