1 2 3 Previous Next 34 Replies Latest reply on Apr 6, 2006 9:24 PM by gavin.king Go to original post
      • 15. Re: Problem using ADF Faces components with SEAM
        gavin.king

         

        "crnip" wrote:
        I showed the whole MainAdministration class. openObject() is just one method. There exist also newObject() method which uses proper newObject pageflow. In the application i have many pageflow definitions. There exist also openObject pageflow definition. In this example I just concentrated on newObject pageflow. OpenObject is exibiting same problem.


        Really, if you want me to help you at this level of granularity, I cant do that if you are going to throw random fragments of code at me.

        So before going any further:

        (1) Simplify down to a very simple isolated example with just two commandLinks, one Seam component, and a pageflow with three nodes.
        (2) Post THE WHOLE THING here.

        I have no problem helping users with problems, but if you don't sufficiently simplify things first, you are wasting both our time.



        • 16. Re: Problem using ADF Faces components with SEAM
          crnip

          Sorry for not beeing specific.

          To start all over. I have a seam component called mainAdministration. This component is conversational in nature. It uses many methods which start a different pageflows. One particular pageflow is called "newObject". This page flow is started by SEAM component "mainAdministration with method newObject.

          @Name(ContextVariables.MAIN_ADMINISTRATION)
          @Scope(ScopeType.CONVERSATION)
          public class MainAdministration {
          
          ...
           @Begin(join=true,pageflow="newObject")
           public String newObject() {
           return NavigationOutcomes.BROWSE;
           }
          ...
          }
          


          This works the same if i remove "join=true". This method starts the conversation of MainAdministration and uses "newObject" pageflow. This pageflow is defined like this:

          <pageflow-definition name="newObject">
           <start-state name="start">
           <transition name="browse" to="selectClass"></transition>
           </start-state>
           <page name="selectClass" view-id="/selectClass.jsp" redirect="true" >
           <description>#{msg.title_selectClass}</description>
           <transition name="browse" to="selectClass"></transition>
           <transition name="cancel" to="mainAdministration"></transition>
           <transition name="select" to="editObject">
           <action expression="#{classSelection.selectClass}" />
           </transition>
           </page>
           <page name="editObject" view-id="/editObject.jsp" redirect="true">
           <description>#{msg.title_editObject} : #{objectType}</description>
           <event type="node-enter">
           <action expression="#{newObject.createObject}" />
           </event>
           <transition name="ok" to="mainAdministration">
           </transition>
           <transition name="cancel" to="mainAdministration">
           <action expression="#{newObject.removeObject}" />
           </transition>
           <transition name="back" to="selectClass">
           <action expression="#{newObject.removeObject}" />
           </transition>
           </page>
           <page name="mainAdministration" view-id="/mainAdministration.jsp" redirect="true">
           <end-conversation />
           </page>
          </pageflow-definition>
          


          In this page flow a transition with name "browse" lead us to the page "selectClass" which is represented by view "selectClass.jsp". Until here everithing works as expected. I did come to this selectClass.jsp where I could click on diferent commandLinks. One particular comandLink is like this.

          <af:commandLink id="aPartner" text="#{msg.class_partner}" action="select">
           <f:param name="objectType" value="Partner" />
           </af:commandLink>

          This commandLink when clicked is associated with "select" action which should according to the SEAM documentation invoke transition with name "select". This transition should take us to the page called "editObject" defined in pageflow. This is where problem starts. It does not take us to the editObject page but instead remains on selectObject page. When I used old seam distribution this transition did occure.

          By the way I did manage to debug code with seam. What I found is the following. Before RenderResponse Phase has who calls which could change view. this code is

          public void beforePhase(PhaseEvent event)
           {
           if ( event.getPhaseId() == RESTORE_VIEW )
           {
          ...
           }
           else if ( event.getPhaseId() == RENDER_RESPONSE )
           {
           callAction( event.getFacesContext() );
           Pages.instance().callAction();
          ...
           }
           }
          
           }
          


          In both method no navigation is performed. In callAction method outcome and action method are to be retrieved from requestParameterMap with keys "actionOutcome" and "actionMethod". This is empty.

          In second part where Pages.instance is used this Pages object all maps and sets are empty. This is then probably why no navigation takes place. I suspect that at least outcomesByViewId map should have some entries

          I hope i helped a little. For future references I will be more specific

          Silvo Koren

          • 17. Re: Problem using ADF Faces components with SEAM
            crnip

            Now i think I find the source of the problem but not the answer. I by mistake though how navigation works. Actually this is the code that should invoke pageflow transitions.

            Manager.instance().prepareBackswitch(event);
            


            This code is excerpt prom beforePhase of SeamPhaseListener. in this method there is an if statement which checks for long running conversations. I shoul be in ling running conversation mode but I am not. Based on posted problem description why am i not no long running conversation mode. I did use @Begin
            when starting this pageflow.

            Silvo Koren

            • 18. Re: Problem using ADF Faces components with SEAM
              gavin.king

              Conversations are propagated whenever you navigate with a <h:commandLink> or <h:commandButton> that is inside a <h:form>, or, by default, when you navigate with <s:link>.

              They are also propagated when you do an <h:outputLink><f:param name="conversationId" value="#{conversation.id}"/></h:outputLink>

              Sounds like you have not propagated your conversation.

              • 19. Re: Problem using ADF Faces components with SEAM
                crnip

                This is exactly why it does not work. By debuging I found out that conversation was not propagated. What is strange is that old distribution of SEAM did propagate conversation ID. Maybe this has some relevance that I use ADF Faces <af:commandLink ..> I wil try the same stuff and put <f:param name="conversationId" value="#{conversation.id}" /> just to see what happens .

                • 20. Re: Problem using ADF Faces components with SEAM
                  crnip

                  OK here are my findings.

                  When I included <f:param name="conversationId" value="#{conversation.id}" /> command links start working. Now there was definitelly a change in the SEAM which now does not do conversation propagation at lieast for ADF Faces command buttons and links. I did not checked standard JSF components <h:commandLink... and <h:commandButton... Just to be sure I again reinstalled jboss-seam,jar from distribution of beta 2 and replaced this nightly build with the beta2 one. My ADF Faces command links and buttons did work.
                  I dont really want to use <f:param.

                  What was the change that ADF Faces command components do not propagate conversation id anymore? Currently I treat solution with <f:param as a workaround.

                  Silvo Koren

                  • 21. Re: Problem using ADF Faces components with SEAM
                    gavin.king

                    Are they inside an <h:form/> ?

                    What happens if you use <h:commandLink> instead?

                    I actually *did* change something in CVS very recently, by putting the conversation id in the PAGE context, instead of directly into the ViewRoot attribute map.

                    However, this should be perfectly OK to do.

                    • 22. Re: Problem using ADF Faces components with SEAM
                      crnip

                      This is definitely a bug. I did checked also with <h:form> and <h:commandLink> and behaviour is the same. "IF YOU DO NOT PROVIDE CONVERSATION ID as parameter" conversation is not propagated.

                      Silvo Koren

                      • 23. Re: Problem using ADF Faces components with SEAM
                        gavin.king

                        Well, it is not quite that simple, since conversations are definitely propagated in the booking demo (even after I remove the redirection).

                        So I need to work out what is unique about your case.

                        Do you have something "funny", like multiple forms on the page, or something?

                        • 24. Re: Problem using ADF Faces components with SEAM
                          gavin.king

                          Oh, and does ADF have funny phaselisteners or servlet filters that could be breaking Seam?

                          • 25. Re: Problem using ADF Faces components with SEAM
                            crnip

                            Hello

                            Yes booking example works. But booking example does not uses pageflows. You shoul try dvd store example. This one is broken. I think this problem is bound to pageflows. Booking example has pages.xml defined so SeamPhaseListener is using this type of navigation and not pageflows.

                            Silvo Koren

                            • 26. Re: Problem using ADF Faces components with SEAM
                              crnip

                              I haver to correct myself.

                              DVD store demo was broken regarding some *.xhtml files. <h:form> tag was missing on some places and i puted it on also on wrong place.

                              DVD Store is working so I have to figure out what is different in our application. We do use a bunch of forms but DVD Store also has such scenario. Maybe this is issue regarding fillers and phaselisteners. I dont have source code for ADF Faces to check this out. What is still strange is that there was some change in SEAM which now does not work anymore. I will still try to figure this out.

                              Silvo Koren

                              • 27. Re: Problem using ADF Faces components with SEAM
                                crnip

                                New findings

                                When I running DVD Store example I allways go throught restoration twice. Conversation restoration happens on a second iteration. In our application restoration happens only one time. And this time conversationId is set to empty string. This is why I dont get conversation propagated. I suspect that no redirections takes place in our example. This is probably why on DVD Store example we have two restorations, because we had two requests. One for issuing action and one for redirection. In our example only one request happens. But I did have redirect set to true.

                                Silvo Koren

                                • 28. Re: Problem using ADF Faces components with SEAM
                                  gavin.king

                                  Right, the navrules in the dvd store example have a . To get to your example you would need to remove the from all the navrules.

                                  • 29. Re: Problem using ADF Faces components with SEAM
                                    crnip

                                    Hello

                                    Here are my new findings. Previous implementation of conversation propagation used a folloving method on class Manager:

                                     public void restoreConversation(Map attributes, Map parameters)
                                     {
                                    
                                     //First, try to get the conversation id from a request parameter
                                     String storedConversationId = getConversationIdFromRequestParameter(parameters);
                                    
                                     if ( isMissing(storedConversationId) && attributes!=null )
                                     {
                                     //if it is not passed as a request parameter, try to get it from
                                     //the JSF component tree
                                     storedConversationId = (String) attributes.get(CONVERSATION_ID);
                                     }
                                    
                                     ...
                                     }
                                    


                                    If conversationId was not retrieved from parameter then it was fetched from some attribute Map.

                                    A new method is like this:

                                     public void restoreConversation(Map parameters)
                                     {
                                    
                                     //First, try to get the conversation id from a request parameter
                                     String storedConversationId = getConversationIdFromRequestParameter(parameters);
                                    
                                     if ( isMissing(storedConversationId) && Contexts.isPageContextActive() )
                                     {
                                     //if it is not passed as a request parameter, try to get it from
                                     //the JSF component tree
                                     //storedConversationId = (String) attributes.get(CONVERSATION_ID);
                                     storedConversationId = (String) Contexts.getPageContext().get(CONVERSATION_ID);
                                     }
                                    
                                     ...
                                     }
                                    


                                    Now you dont use attribute map but instead use Page context. And here now lies my problem. In old implementation i did have component CONVERSATION_ID registered in a attribute map so it was retrieved, but in new implementation this component is not present in page context. Because
                                    of this my conversation does not propagate. Now i dont know where this should be set, but I do think that there is a possible bug which is well hidden. At least in my situation this happens.

                                    Silvo Koren