1 2 Previous Next 18 Replies Latest reply on Nov 30, 2007 6:52 AM by Laurent Parcet

    Problems with links in pageflow pages based on templates

    Olivier Thierry Apprentice

      Hi,

      In a Seam application, I use JPDL to define pageflows. All pages of my application use facelet templates. Transitions modeled in my pageflow work well, but I have a problem with links defined with s:link component in my template (for example a link to home page in a header) : Seam throws a "Illegal navigation" error.

      I understood this message is thrown because there is no transition to home page modeled in my pageflow. But I can't do this because when I model my pageflow I have no idea which links will exist in the templates my pageflow pages will be based on.

      I found two solutions for this, but I am fully happy with none of them ...

      1 - I added propagation="node" attribute to s:link :

      <s:link view="/home" value="Accueil" propagation="none" />


      The problem with this solution is that it keeps conversations opened, while I'd like them to be closed.

      2 - I added propagation="end" attribute to s:link

      <s:link view="/home" value="Accueil" propagation="end" />


      With this solution, the conversations end. But the problem is I have to click the link twice to go to home page :
      - The first click ends the conversation
      - The second click redirects to the home page.

      Does anyone have a solution for this ?

      I work with Seam 2.0.0.CR1 and JBPM 3.2.2

      Any help appreciated ;)
      Thanks in advance

        • 2. Re: Problems with links in pageflow pages based on templates
          Olivier Thierry Apprentice

          I don't think this is what causes my problem. I tried with /home.xhtml or /home.seam, and I have the same problem.

          • 3. Re: Problems with links in pageflow pages based on templates
            Olivier Thierry Apprentice

            Hi,

            I still have not found a solution to this problem and it still exists with newer versions of Seam. When running a pageflow conversation, only links modeled in the pageflow work, others throw an "illegal navigation" error . But when you use templates, there are links you should not have to add to your pageflow !

            So is there a way to disable navigation check on some links when running a pageflow conversation ?

            • 4. Re: Problems with links in pageflow pages based on templates
              Pete Muir Master

              Doing a link based on a viewId like

              <s:link view="/foo.xhtml" />



              certainly should work from inside a pageflow.

              Post the exception and server log from the start of the request

              • 5. Re: Problems with links in pageflow pages based on templates
                Olivier Thierry Apprentice

                Thanks for your response.

                Well, there is no exception, but nothing happens when I click on the link (same behaviour as a null return from a backing bean) and I have this message in the server log :

                sourceId=null[severity=(WARN 1), summary=(Illegal navigation), detail=(Illegal navigation)]


                If you say it should work, it means there is something I do wrong.

                My pageflow is as following :

                <?xml version="1.0" encoding="UTF-8"?>
                
                <pageflow-definition name="processusCrud">
                 <start-state name="start">
                 <transition name="default" to="infosGeneralesProcessus" />
                 </start-state>
                 <page name="infosGeneralesProcessus" view-id="/processus/processusCrud/infosGeneralesProcessus.xhtml">
                 <redirect/>
                 <transition to="processus paramétrable ?" name="suivant"></transition>
                 <transition to="fin" name="annuler">
                 <action expression="#{processusCrud.annuler}" />
                 </transition>
                 </page>
                 <decision name="processus paramétrable ?" expression="#{processusCrud.modeleProcessusSelectionne.parametres != null}">
                 <transition to="parametrageProcessus" name="true">
                 <action expression="#{processusCrud.refreshParametrage}" />
                 </transition>
                 <transition name="false" to="recapitulatifProcessus"></transition>
                 </decision>
                 <page name="parametrageProcessus" view-id="/processus/processusCrud/parametrageProcessus.xhtml">
                 <redirect/>
                 <transition to="recapitulatifProcessus" name="suivant"></transition>
                 <transition name="precedent" to="infosGeneralesProcessus"></transition>
                 <transition to="fin" name="annuler">
                 <action expression="#{processusCrud.annuler}" />
                 </transition>
                 </page>
                 <page name="recapitulatifProcessus" view-id="/processus/processusCrud/recapitulatifProcessus.xhtml">
                 <redirect/>
                 <transition to="fin" name="valider">
                 <action expression="#{processusCrud.valider}" />
                 </transition>
                 <transition name="precedent" to="parametrageProcessus"></transition>
                 <transition to="fin" name="annuler">
                 <action expression="#{processusCrud.annuler}" />
                 </transition>
                 </page>
                 <page name="fin" view-id="/processus/listeProcessus.xhtml">
                 <redirect/>
                 </page>
                </pageflow-definition>


                The pageflow is started with a @Begin annotaion:

                @org.jboss.seam.annotations.Begin(pageflow = "processusCrud", join = true)
                public java.lang.String select(mypackage.processus.VOProcessus processus)
                 {}


                And my select method is called this way ...

                <s:button value="#{messages['label.nouveau']}" action="#{processusCrud.select(null)}" />


                ... or this way :

                <h:commandButton id="cmdDetail" value="#{messages['label.detail']}" action="#{processusCrud.select(processus)}" />
                


                The link in my template is :

                <s:link view="/home.xhtml" value="Accueil" />


                Is there anything more to do ?

                • 6. Re: Problems with links in pageflow pages based on templates
                  Laurent Parcet Newbie

                  Hy.

                  In your template, try to remove the view tag.

                  There's obviously a problem with redirect tag in the page flow and view tag in the templates.

                  This solution work's for my problem.
                  see here http://www.jboss.com/index.html?module=bb&op=viewtopic&t=124715

                  If it doesn't work, i think you have to add some code like this in your page.xml:

                  <page view-id="*">
                   <navigation from-action="#{myAction}">
                   <end-conversation/>
                   <redirect view-id="myPath/home.xhtml"></redirect>
                   </navigation>
                   </page>




                  • 7. Re: Problems with links in pageflow pages based on templates
                    Olivier Thierry Apprentice

                    Do you mean I should replace the <s:link view="/home.xhtml" /> by something like <s:link action="#{myComponent.action}" /> ?

                    • 8. Re: Problems with links in pageflow pages based on templates
                      Laurent Parcet Newbie

                      You should try. It works for me.

                      As i understand, there's a problem using view tag in a template and redirect tag in the pageflow.

                      They don't work together. Why? I currently still don't know.

                      Or if you don't know how to replace your view code by an action code, remove your redirect tag in your pageflow. But i don't know what are the consequences when you refresh your page.

                      • 9. Re: Problems with links in pageflow pages based on templates
                        Olivier Thierry Apprentice

                        I tried all what you said, and I still have the problem. In fact I have two links in my template :

                        <s:link action="#{navigation.retourAccueil}" value="Accueil" propagation="end" />
                        
                        <s:link action="#{identity.logout}" value="Deconnexion" rendered="#{identity.loggedIn}" propagation="end" />


                        The one binded to action {identity.logout} works well. But not the one binded to the action I wrote, which still throws an "illegal navigation" error while I can't see differences between them ! The problem is the same if I use view="/home.xhtml" attribute instead of action one. Same problem too when I remove all tags in the pageflow definition.

                        My "navigation" Seam component is like this :

                        @Name("navigation")
                        @Scope(ScopeType.SESSION)
                        public class NavigationAction {
                        
                         public void retourAccueil() {
                         }
                        }


                        My pages.xml file in /WEB-INF :

                        <page view-id="*">
                         <navigation from-action="#{navigation.retourAccueil}">
                         <end-conversation />
                         <redirect view-id="/home.xhtml" />
                         </navigation>
                         <navigation from-action="#{identity.logout}">
                         <end-conversation />
                         <redirect view-id="/home.xhtml"></redirect>
                         </navigation>
                        </page>


                        Do you see something different compared with what you did ?

                        • 10. Re: Problems with links in pageflow pages based on templates
                          Olivier Thierry Apprentice

                          Sorry .... Please read "Same problem too when I remove all redirect tags in the pageflow definition.

                          • 11. Re: Problems with links in pageflow pages based on templates
                            Laurent Parcet Newbie

                            The only thing i see is the difference between the two redirection in your page.xml.

                            the fist one you wrote (and doesn't work) is

                            <redirect view-id="/home.xhtml" />


                            and the secon one is
                            <redirect view-id="/home.xhtml"></redirect>


                            Try to inverse those two redirections and see what happen.

                            if it works, try something like this

                            <page view-id="*">
                             <navigation from-action="#{navigation.retourAccueil}">
                             <end-conversation />
                             <redirect view-id="/home.xhtml"></redirect>
                             </navigation>
                             <navigation from-action="#{identity.logout}">
                             <end-conversation />
                             <redirect view-id="/home.xhtml"></redirect>
                             </navigation>
                            </page>



                            • 12. Re: Problems with links in pageflow pages based on templates
                              Olivier Thierry Apprentice

                              It still doesn't work ... The link is the same, the navigation configuration is the same, the only difference is that I use different components. So it must come from my "navigation" component. I added @BypassInterceptors annotation to my component (this is what is done with "identity" component, but it changes nothing. Which annotations did you put on your component class and on its methods ?

                              • 13. Re: Problems with links in pageflow pages based on templates
                                Laurent Parcet Newbie

                                I only use identity coponent so i do nothing more than what seam has done.

                                But i notice something else yesterday.

                                I have a main pageflow with a sub-pageflow.

                                At the first strike, it doesn't work because i leave propagation=none in my s:link

                                Without it, it works. I'll try today to restore it and change the option to see what happen.

                                Just a question:
                                I use Seam 2.0.0.GA, november 2007.

                                Which one do you use?

                                1 2 Previous Next