[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1574) pages.xml actions are not called when using "render" with s:link and s:button

Michael Youngstrom (JIRA) jira-events at lists.jboss.org
Thu Jul 26 18:46:47 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1574?page=comments#action_12370201 ] 
            
Michael Youngstrom commented on JBSEAM-1574:
--------------------------------------------

Ok, so here is a new patch taking into account Norman's comments:

So now redirect and render will function the same with regard to page elements.  Always the first thing executed would be the s:link action and then based on there result if we do a "render" then "no-conversation-view" will be checked for the new view id, "login-required" will be checked, and page actions will be executed.  If the result is a "redirect" then none of that will occur for the old view id but it will all occur for the new view id.

It appeared that this used to function in a buggy way.  When a user would click on an s:link action and a redirect were to take place then all of these operations would happen twice once for the old view id and once for the new view id.  I think this fixes this problem so page actions, login-required, and no-conversation-view now only take place once per action being processed and take place always for the new view-id.  Much better in IMHO?

Thoughts?


Index: src/main/org/jboss/seam/navigation/Pages.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/navigation/Pages.java,v
retrieving revision 1.11
diff -u -r1.11 Pages.java
--- src/main/org/jboss/seam/navigation/Pages.java	25 Jul 2007 14:40:31 -0000	1.11
+++ src/main/org/jboss/seam/navigation/Pages.java	26 Jul 2007 22:38:11 -0000
@@ -272,32 +270,36 @@
 
       //redirect if necessary
       List<Page> pageStack = getPageStack(viewId);
-      for ( Page page: pageStack )
-      {         
-         if ( isNoConversationRedirectRequired(page) )
-         {
-            redirectToNoConversationView();
-            return false;
+      
+      //run the s:link / s:button action after checking the
+      //conversation existence!
+      boolean result = callAction(facesContext);
+
+      //If responseComplete then we're probably doing a redirect so don't call the page actions now.
+      if(!facesContext.getResponseComplete()) {
+         for ( Page page: pageStack )
+         {         
+            if ( isNoConversationRedirectRequired(page) )
+            {
+               redirectToNoConversationView();
+               return false;
+            }
+            else if ( isLoginRedirectRequired(viewId, page) )
+            {
+               redirectToLoginView();
+               return false;
+            }
          }
-         else if ( isLoginRedirectRequired(viewId, page) )
-         {
-            redirectToLoginView();
-            return false;
+        
+         //run the page actions, check permissions,
+         //handle conversation begin/end
+         String newViewId = getViewId(facesContext);
+         for ( Page page: getPageStack(newViewId) )
+         {         
+            result = page.preRender(facesContext) || result;
          }
       }
 
-      //run the page actions, check permissions,
-      //handle conversation begin/end
-      boolean result = false;
-      for ( Page page: pageStack )
-      {         
-         result = page.preRender(facesContext) || result;
-      }
-      
-      //run the s:link / s:button action after checking the
-      //conversation existence!
-      result = callAction(facesContext) || result;
-      
       return result;
    }

> pages.xml actions are not called when using "render" with s:link and s:button
> -----------------------------------------------------------------------------
>
>                 Key: JBSEAM-1574
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1574
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: JSF
>    Affects Versions: 2.0.0.BETA1
>            Reporter: Michael Youngstrom
>         Assigned To: Gavin King
>             Fix For: 2.0.0.CR1
>
>
>     <page view-id="/list.xhtml">
>     	<navigation>	
>                 <rule if-outcome="detail">
>       		     <render view-id="/detail.xhtml"/>
>                 </rule>
>     	</navigation>
>     </page>
>     <page view-id="/detail.xhtml" action="#{bean.loadDetail}"/>
> Does not appear to call #{bean.loadDetail} when the list navigation rule is executed.
> Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list