10 Replies Latest reply on Sep 2, 2009 6:43 AM by nbelaevski

    Problem sending parameter objects to another view while navi

    shayan

      Hi

      I want to navigate to from view A to view B. The user clicks a button on view A and request is submitted to the backing bean, its processed and result is returned. Now the user is to be navigated to view B.
      Now the problem here i am facing is that the result returned must be shown on view B.

      How can I send the result object to the next view's backing bean??

      Thanks in advance

        • 1. Re: Problem sending parameter objects to another view while
          nbelaevski

          Hi,

          If you are not using redirect navigation, then all beans should be available when view B is rendered to the client, otherwise request scoped beans will be recreated because redirect happens in a separate request.

          • 2. Re: Problem sending parameter objects to another view while
            shayan

            Thanks for the reply.

            yes. backing bean of View A will be available to Vew B but in that case view B will be using backing bean of View A. and Ii want to move to Backing bean of view B. so I will have to send the object to the next backing bean that is of View B's backing.

            How will i do this??

            • 3. Re: Problem sending parameter objects to another view while
              nbelaevski

              Sorry, but I don't understand your question. Please clarify what do you exactly mean by "send the object to the next backing bean"?

              • 4. Re: Problem sending parameter objects to another view while
                shayan

                suppose view A has backingBeanA and view B has backingBeanB. User initiates a request on view A which is processed by an action listener in backingBeanA and an object is returned by the busines logic layer in response. This object contains results of the process. Now the user is to be directed to view B which has backingBeanB and the result of the process is to shown on view B. So In this case, the resulted object should passed to the backingBeanB so that view B should ba able to show its values.

                According to your first reply, backingBeanA remains available to view B and can show the resulted object of the processing, but view B has its own backing bean and it should show the values from its own backing bean.

                I hope you would have understand the scenario....

                • 5. Re: Problem sending parameter objects to another view while
                  ilya_shaikovsky

                  unfortunatelly still not clear. Maybe some code sample?

                  • 6. Re: Problem sending parameter objects to another view while
                    shayan

                    Ok. Here is a real life scenario.

                    This is about an online shopping scenario.
                    There are two views when a customer selects an item to buy. On the first view customer will enter the details of his credit card, his country, state etc. Then after filling form user will click on next button which will invoke action method "createOrder" of backing bean named "CreateOrderController". That is
                    public String createOrder(){

                    }

                    In createOrder method, use'sr country and state information will be processed for calculation of tax charges and shipment charges.

                    like
                    public String createOrder(){
                    Order order=new Order();
                    order.set....(...)
                    ...................
                    Charges charges=chargesCalculator.calculateCharges(order);

                    return "success";
                    }

                    chargesCalculator.calculateCharges() method returns object of "Charges" which contains all info about the tax and shipment charges .
                    Now the user will be directed to next view when "success" is returned, where the user will be shown the complete charges for the item.This view is "CompleteOrderView" with backing bean named "CompleteOrderController".

                    Now on the complete order view, the user will have to be shown the charges which is encapsulated in the "Charges" object which means that this object must be passed to the "CompleteOrderController" in order to show its values.

                    So what i wanted to ask is that how to pass the "Charges" object from the "CreateOrderController" to "CompleteOrderController" ??


                    • 7. Re: Problem sending parameter objects to another view while
                      nbelaevski

                      http://www.exforsys.com/tutorials/j2ee/servlet-basics.html

                      JBoss Seam introduces additional very useful scopes - check them also.

                      • 8. Re: Problem sending parameter objects to another view while
                        shayan

                        This link doesnt address my problem. Its not about wt my problem is.
                        Looks like i am unable to find solution to this problem on this forum :-( . Anyways, thanks for your replies.......

                        • 9. Re: Problem sending parameter objects to another view while
                          nbelaevski

                          You want to keep objects - scopes exists for that. The article described standard ones.

                          • 10. Re: Problem sending parameter objects to another view while
                            nbelaevski

                            Also check keepAlive and state API demos at livedemo - both provide extended scopes.