3 Replies Latest reply on Apr 26, 2008 12:12 AM by Erdem Agaoglu

    page action and redirect

    Erdem Agaoglu Newbie


      When i try to add an action to the page that has redirect option, it causes infinite recursive redirect.

      pages.xml is like

      <page view-id="/test.xhtml">
           <action execute="#{someComponent.echo}"/>
           <description>Test Page</description>
           <param name="someVal" value="#{someComponent.val}" />

      and someComponent is a standard POJO

      public class SomeComponent implements Serializable {
           @Logger Log log;
           private String val;
           public String getVal() {return val;}
           public void setVal(String val) {this.val = val;}
           public void echo(){
                log.info("method call");

      I think the problem is somewhere around navigation-redirect but i tried every possible phrase i can imagine. Only thing that works is the state that i add navigation-redirects with from-actions for each JSF action on test.xhtml, which i dont want to.

      Another problem i saw is that redirect in pageflow did not work with or without page actions.

      <start-page name="test" view-id="/test.xhtml" >
           <description>Test Page</description>

      which i put use by

      <s:link view="/test.xhtml"
             value="To Test"

      but i did not debug this much.

      Is this usage of pages.xml wrong? or am i missing sth simple? i am using seam 2.0.1-ga and jboss 4.2.2-ga

        • 2. Re: page action and redirect
          Andy Gibson Novice

          The example you gave does indeed cause some weird recursive redirecting, but it appears to be following what you asked it to do.

          What is it you are trying to achieve with this pages.xml entry?


          Andy Gibson

          • 3. Re: page action and redirect
            Erdem Agaoglu Newbie

            i am trying to get this page to render as usual on any non-JSF request, and get redirected on JSF requests to avoid refresh issues. But the actions should be called regardless of the request type.

            Actually it also seems to me that i ask it to redirect recursively. i debug some more and it goes more or less like

            1. call action on the page

            2. because action is returns void/null render same page

            3. this page requires redirect so redirect

            4. now another request to the same page, call action again

            5. ...

            This process seems ok if page actions are a way to modify navigation which gets me to the point that confuses me in the first place. Ref tells

            The page action method can return a JSF outcome. If the outcome is non-null, Seam will use the defined navigation rules to navigate to a view.

            I dont have much experience with JSF and/or Seam but IMHO page actions should not be treated as JSF outcomes. I am just thinking loudly, when i got to the render response i should "render response", not evaluate it. Page actions in pages.xml are to be triggered just before rendering the page i have determined at the Invoke Application. And for the non-JSF requests since i dont have any Invoke Application i should just render the page that is requested. I am still thinking loudly another argument to that behaviour is since i can define multiple page actions on a page, which action will determine the simulated JSF outcome and process the navigation as required (one method may return "success" and the other may "failure"). But as i said i might be wrong at all of this.

            And in my case page action returns null (or void to be precise) so seam should not use defined navigation rules.

            Besides all, how am i supposed to do what i actually try?