8 Replies Latest reply on Oct 27, 2007 6:44 AM by Pete Muir

    Get Request problems with Seam 2 CR1

    Brian Smith Apprentice

      I am having some trouble since converting from Seam 2 Beta to CR1 with a Get Request in combination with a pageflow

      When I use an s:link to navigate to a page

      Here is what was working

      <s:link
       view="/servicerequest.xhtml"
       value="#{req.serviceRequestNumber}">
       <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
      </s:link>


      <page view-id="/servicerequest.xhtml">
       <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
       converterId="javax.faces.Long"/>
       <begin-conversation join="true"/>
       <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
      </page>


      When I click the s:link I get an error message passed into facesMessages "Illegal Navigation"

      I changed the s:link to use a pageflow instead

      <s:link
       view="viewServiceRequest"
       value="#{req.serviceRequestNumber}">
       <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
      </s:link>


      <page name="serviceRequest" view-id="/servicerequest.xhtml"
       back="enabled">
       <redirect/>
       <transition name="viewAssignments" to="assignmentListing"/>
       </page>


      Now the parameter is not being propagated and the #{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)} action is not being called. I guess this is because the page action in pages.xml is not picking up on the call from the pageflow.

      When i remove the redirect from the pageflow, the url looks correct (parameter propagated) but the action defined in pages.xml is still not being called.

      So a few questions.

      1. How can I propagate request parameters across redirects?
      2. How can I call a page action (pages.xml) from a pageflow navigation?
      3. Why is my first example resulting in a "Illegal Navigation" error?

        • 1. Re: Get Request problems with Seam 2 CR1
          Brian Smith Apprentice

          Ok, let me bump this with a rephrased question.

          What is the proper way to output a GET link when a page is called via a pageflow?

          <pageflow-definition name="serviceRequestCreation>
          ...
          
          <page name="serviceRequestListing" view-id="/addressrequestlisting.xhtml"
           back="enabled">
           <transition name="viewServiceRequest" to="serviceRequest">
           <action expression="#{addressLocator.selectServiceRequest}"/>
           </transition>
           </page>
          
           <page name="serviceRequest" view-id="/servicerequest.xhtml"
           back="enabled">
           <redirect/>
           </page>
          ....
          </pageflow-definition>
          


          <page view-id="/servicerequest.xhtml">
           <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
           converterId="javax.faces.Long"/>
           <begin-conversation join="true" pageflow="serviceRequestCreation"/>
           <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
           </page>


          What am I missing?

          Using an s:link to call "viewServiceRequest" does allow the request parameter to propagate across the redirect. If I don't use a redirect then the link points to the calling page which is not what I want either.

          When pasting the link into the browser from outside of the pageflow, it works as expected.


          • 2. Re: Get Request problems with Seam 2 CR1
            Pete Muir Master

             

            "smithbstl" wrote:
            I am having some trouble since converting from Seam 2 Beta to CR1 with a Get Request in combination with a pageflow

            When I use an s:link to navigate to a page

            Here is what was working

            <s:link
             view="/servicerequest.xhtml"
             value="#{req.serviceRequestNumber}">
             <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
            </s:link>


            <page view-id="/servicerequest.xhtml">
             <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
             converterId="javax.faces.Long"/>
             <begin-conversation join="true"/>
             <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
            </page>


            When I click the s:link I get an error message passed into facesMessages "Illegal Navigation"


            This looks like regression to me. What libraries are you using with your project? RichfFaces?

            I changed the s:link to use a pageflow instead


            You mean a logical outcome right?

            • 3. Re: Get Request problems with Seam 2 CR1
              Brian Smith Apprentice

              Yes, I am using Richfaces 3.1

              Yes, the s:link is pointing to a transition in a pageflow

              <s:link
               view="viewServiceRequest"
               value="#{req.serviceRequestNumber}">
               <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
              </s:link>


              <page name="serviceRequestListing" view-id="/addressrequestlisting.xhtml"
               back="enabled">
               <transition name="viewServiceRequest" to="serviceRequest">
               <action expression="#{addressLocator.selectServiceRequest}"/>
               </transition>
               </page>





              • 4. Re: Get Request problems with Seam 2 CR1
                Pete Muir Master

                Have you read http://www.jboss.com/index.html?module=bb&op=viewtopic&t=119400 (Sorry, I forgot to post about this earlier).

                AFAICS the page action should be called even when in a pageflow. I will try to dig into it if you are having problems.

                • 5. Re: Get Request problems with Seam 2 CR1
                  Brian Smith Apprentice

                  Yeah, I saw that. I will give it another go later today. I may also upgrade to RF 3.1.1 snapshot to see if that helps at all.

                  otherwise I may just have to re-engineer to not use pageflows at all.

                  Thanks again Pete

                  • 6. Re: Get Request problems with Seam 2 CR1
                    Brian Smith Apprentice

                    Pete, I'm still having problems. Everything works when I remove the redirect/ from my transition.

                    Basically what I want to happen is....

                    I have a search page called addresslookup.xhtml. This forwards to addressrequestlisting.xhtml which then should redirect to servicerequest.xhtml with the desired parameter supplied like shown in my previous post. This is handled via pages.xml

                    Here is my pageflow file

                    <pageflow-definition
                     xmlns="http://jboss.com/products/seam/pageflow"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation= "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
                     name="serviceRequestCreation">
                     <start-page name="addressSearch" view-id="/addresslookup.xhtml">
                     <transition name="viewServiceRequests" to="serviceRequestListing">
                     <action expression="#{addressLocator.viewServiceRequests}"/>
                     </transition>
                    
                     <page name="serviceRequestListing" view-id="/addressrequestlisting.xhtml"
                     back="enabled">
                     <transition name="viewServiceRequest" to="serviceRequest"/>
                     </page>
                    
                     <page name="serviceRequest" view-id="/servicerequest.xhtml"
                     back="enabled">
                     <redirect/>
                     <transition name="viewAssignments" to="assignmentListing"/>
                     </page>
                    </pageflow-definition>


                    Here is pages.xml

                    <page view-id="/servicerequest.xhtml">
                     <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
                     converterId="javax.faces.Long"/>
                     <begin-conversation join="true" pageflow="serviceRequestCreation"/>
                     <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
                     </page>


                    Here is the link in question (req is a var defined in a dataTable). This datatable is also part of facelet hierarchy supplied to addressrequestlisting.xhtml via a ui:include. The value of the datatable is also supplied via ui:param. This may be pertinent based on this http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117233 but I think its not related.
                    <s:link
                     action="viewServiceRequest"
                     value="#{req.serviceRequestNumber}">
                     <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
                    </s:link>


                    When this link is clicked the parameters are NOT showing up in the resulting page's (servicerequest.xhtml) address bar. Only the conversationId (cid) is propagated.

                    When I remove the redirect from the pageflow
                    <page name="serviceRequest" view-id="/servicerequest.xhtml"
                     back="enabled">
                     <transition name="viewAssignments" to="assignmentListing"/>
                     </page>


                    and change the view defined in pages.xml to this
                     <page view-id="/addressrequestlisting.xhtml">
                     <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
                     converterId="javax.faces.Long"/>
                     <begin-conversation join="true" pageflow="serviceRequestCreation"/>
                     <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
                     </page>


                    everything works as expected. The only difference is I am use a forward instead of a redirect.

                    I am using Seam 2 CR1 with the latest RichFaces snapshots (9-23-2007)

                    Thanks again.

                    • 7. Re: Get Request problems with Seam 2 CR1
                      Brian Smith Apprentice

                      Ok, I have it working now but a few things seem rather odd about what I am doing and why it is working.

                      I changed pages.xml to this

                      <page view-id="/servicerequest.xhtml">
                       <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
                       converterId="javax.faces.Long"/>
                       <begin-conversation join="true" pageflow="serviceRequestCreation"/>
                       </page>
                      
                      
                       <page view-id="/addressrequestlisting.xhtml">
                       <param name="serviceRequestId" value="#{serviceRequestManager.serviceRequestId}"
                       converterId="javax.faces.Long"/>
                       <begin-conversation join="true" pageflow="serviceRequestCreation"/>
                       <action execute="#{serviceRequestManager.loadServiceRequest(serviceRequestManager.serviceRequestId)}"/>
                       </page>


                      And added the redirect back into the pageflow

                      <page name="serviceRequestListing" view-id="/addressrequestlisting.xhtml"
                       back="enabled">
                       <transition name="viewServiceRequest" to="serviceRequest"/>
                       </page>
                      
                       <page name="serviceRequest" view-id="/servicerequest.xhtml"
                       back="enabled">
                       <redirect/>
                       <transition name="viewAssignments" to="assignmentListing"/>
                       </page>


                      Now a few things strike me as odd

                      1. When I hover the mouse over this link
                      <s:link action="viewServiceRequest"
                       value="#{req.serviceRequestNumber}">
                       <f:param name="serviceRequestId" value="#{req.serviceRequestId}" />
                      </s:link>


                      the browser is displaying
                      http://localhost:8080/srms/addressrequestlisting.seam?serviceRequestId=1&dataModelSelection=&actionOutcome=viewServiceRequest&cid=5

                      in the status bar instead of http://localhost:8080/srms/servicerequest.seam......
                      since that is where the pageflow is pointing.

                      2. When I go directly to
                      http://localhost:8080/srms/servicerequest.seam?serviceRequestId=1
                      #{serviceRequestManager.loadServiceRequest(serviceRequestId)} is called eventhough I have removed the action it was defined in from pages.xml where servicerequest.xhml is defined. I have no idea how Seam knows to call this method especially since its NOT annotated using @Factory or @Create

                      It seems there is some magic going on somewhere that I can't seem to lay a handle on.

                      • 8. Re: Get Request problems with Seam 2 CR1
                        Pete Muir Master

                        Do you still have issues here?