1 2 Previous Next 26 Replies Latest reply on Oct 28, 2005 12:44 PM by marius.oancea Go to original post
      • 15. Re: booking demo on jBoss site
        marius.oancea

        Some peoples proposed to add a @Create annotated method where you call the findHotels() but I tried and I got strange errors (e.g. Duplicate id_0). The error seems random. Even worst, sometime it's working.

        Any other solution?

        • 16. Re: booking demo on jBoss site
          gavin.king

           

          How to eliminate the Find button in Booking example? To show hotel list by GET request directly, with @DataModel variable initialization.


          The DVD Store example in CVS shows how to do this.

          • 17. Re: booking demo on jBoss site
            alextemnokhod

            I tried @Create method in HotelBookingAction class, but it isn't invoked when accessing #{hotels} variable and this variable remains uninitialized...
            Generally, is it possible to trigger invocation of find() or other action method when user directly access jsf page (by typing URL in the browser, via GET request)?

            • 18. Re: booking demo on jBoss site
              gavin.king

              yes, look at the dvd store demo!

              • 19. Re: booking demo on jBoss site
                marius.oancea

                You mean by using
                <h:commandLink action="#{showorders.findOrders}" value="My Orders"/>
                ?

                But this is also a kind of Search button. What to do if i have to present a table right after login?

                • 20. Re: booking demo on jBoss site

                  The DVD Store doesn't do this. I've yet to find a satisfactory way of doing this in Seam. Right now you can use @Create to populate an object, but it doesn't work will with @Out/@DataModel. You have to go back to #{bean.value}. I'm still searching for a reasonable way of doing this.

                  • 21. Re: booking demo on jBoss site
                    gavin.king

                    Hum, yes, I guess the interceptor stack is not called from the @Create method.

                    So we should try to figure out some way to allow a create method to be intercepted (icky).

                    I'll add that to JIRA.

                    • 22. Re: booking demo on jBoss site
                      gavin.king

                      Actually I'm not so sure about that. EJB @Create methods still get intercepted, I suppose.

                      • 23. Re: booking demo on jBoss site

                        Yes, but how is the instance going to be created without an action call? You have to set up a fake property and access "#{mybean.nothingToSeeHere}" on your page. Then mybean will be created and properties will be outjected.

                        You also have the problem of not being able to talk conversationally to a component when you do that. As I recall (it's been a couple weeks since I've tried to work on this problem) because there is no action, the conversation is discarded at the end the request so you can't really work with a table model effectively. I'd have to play with it for a few minutes to remember the exact issues. But the net result was that it didn't work well.

                        • 24. Re: booking demo on jBoss site
                          gavin.king

                          Basically the only problem I see here is that you are trying to outject a value without calling an action listener method.

                          As long as you have @Intercept(ALWAYS), there should be no problem doing this in a @Create method.

                          So this boils down to a problem of causing a component to be instantiated. Various options exist, including:

                          <% foo.noop(); %>
                          <% Component.getInstance("foo", true); %>

                          But it might make sense for us to create a custom tag like:

                          <seam:instantiate name="foo"/>

                          You could easily write such a custom tag yourself, all it needs to do is call Component.getInstance(name, true);

                          This should completely solve the problem, I suppose.

                          Another possibility would be for us to have the notion fof a Seam event listener that is called when a GET request occurs for a particular URL. JSF does not have this notion. Perhaps Seam could.

                          • 25. Re: booking demo on jBoss site

                            I have been promoting the latter idea, which is to have some sort of implicit action invocation on a GET. But, the more I think about it, being able to reference components from your view (perhaps seam:require instead of seam:instantiate?) seems to enable more interesting functionality.

                            • 26. Re: booking demo on jBoss site
                              marius.oancea

                              Yes, are going in the direction of Micro~$1 and Sofia framework. I think is not a bad ideea to have such a tag.

                              <seam:require>serv1</seam:require>
                              <seam:require>serv2</seam:require>
                              ...

                              1 2 Previous Next