3 Replies Latest reply on May 15, 2007 10:49 PM by Andy Gibson

    Search Form Scope

    Andy Gibson Novice

      I have a quick question regarding the scope of a bean used in a search form. The search bean holds a fixed number of results (i.e. the first 100 results) and since it is not an unbounded query, I'd like to make it stateful so I don't have to re-query every time the user changes page number, or triggers some other action.

      So, I could use the conversational scope, but that seems overkill since it is only one page. I know some of the examples use Session scope but I don't want the results lingering round in the session.
      I could use a conversation since there are only a couple of links out of the page to put the end conversation tags on.

      I did take a look at page scope, but it cannot be a stateful bean, but it would be nice to have a bean that lasted for the duration of the page and could be stateful.

      Which leads me to another question. Whats the difference between event and page scope? For that matter, when you have a stateless bean, why have scope at all since I thought they were all shared between threads since they are stateless? My thinking was that a pool of stateless beans could be used to provide the bean to threads that needed it, and since it was stateless, after the call, it can be returned to the pool. I realize that this is probably an implementation issue on the application server, and may not apply across all servers.

        • 1. Re: Search Form Scope
          Andy Gibson Novice

          What? nobody using non-session scoped, stateful search forms? ;-)

          • 2. Re: Search Form Scope
            Matt Drees Master

            I think most people would use a conversation here. I would, at least. As I understand it, conversations aren't really heavy-weight.

            • 3. Re: Search Form Scope
              Andy Gibson Novice

              Ok, thanks matt.

              It's not so much the resources, its more a case of having to deal with the conversation on the page (ending it properly).

              If they search and click a menu item to move to another section, then the conversation sticks around, assuming that you have propagation="none" on your menu links. propagation="end" on the menu links would be ideal for the search page menu links since when you navigate out, you end the conversation, but you can't do that if you want to share the menu with "proper" conversational pages. In that case, every time you navigate out, you end the conversation instead of keeping the conversation as a workspace.

              You could duplicate the menu, one for conversational (propagate="none") and one for single conversation pages where propagation="end", but that is just messy.

              I was just hoping for some answer to the page scoped issue where I can have a scope that lasts as long as the user is on the page.

              I'm just paranoid that performance is going to shoot down in the event of having too many conversations floating around (we have about 1,000) users.