1 Reply Latest reply on Jan 5, 2012 3:53 PM by lightguard

    one interactive page, which scope and bean type

    pabia1

      I am looking for general guidance how to handle an interactive page. 
      I have a page that has list of DB objects CRUD operation. EX:  page represents a car dealer lot, and cars can be added, deleted and/or edited without leaving the page. I want to be able to leave the page at any time with the state saved.
      I tried few combinations; right now I use Seam 3.2 CR1, Jboss7.02, RichFaces 4.1 and Seam persistence. I tried EJB 3.1 and CDI beans.


      My challenges:
      - view scope is apparently not great choice, is it?
      - I don’t know where to end conversation without having explicit confirm button.
      - Is a good practice to save state to DB as I go, or do one bulk update at the end
      - I am not sure when to start, preRenderView, @PostConstruct ?
      - Is setting conversation Timeout a good practice?
      - My page is actually a panel in  rich:tabPanel and therefore cannot be associated one-to-one with a view.  If necessary I can “extract” the page. 


      Thanks for any comments

        • 1. Re: one interactive page, which scope and bean type
          lightguard

          - view scope is apparently not great choice, is it?


          What makes you think that? If you're on the same page, that would work fine.



          - I don’t know where to end conversation without having explicit confirm button.


          I guess that all depends on how many units of work you have. If each tab is it's own unit of work, such as adding a car, one for editing, etc. Then each tab would be it's own conversation. If you go this way, you'll want to check to see if there's already a conversation running and end that and start a new one as the built-in CDI conversation doesn't allow for suspending conversations.



          - Is a good practice to save state to DB as I go, or do one bulk update at the end


          Really depends on which way you want to go, and if it's acceptable to have your users redo the work they just did if something goes wrong or they step away from the computer for a while. That one is a requirement you and your business will have to decide upon.



          - I am not sure when to start, preRenderView, @PostConstruct ?


          If you're talking about starting a conversation, a view action works well for this, as does post construct for the first / main bean of the page.



          - Is setting conversation Timeout a good practice?


          There is a timeout by default, but if you need it longer / shorter, then yes you'll have to set it and there's nothing wrong with that.



          - My page is actually a panel in  rich:tabPanel and therefore cannot be associated one-to-one with a view.  If necessary I can “extract” the page.


          That's fine, I've seen this sort of thing done before.