[jboss-jira] [JBoss JIRA] Created: (JBSEAM-343) Action method of source page being executed after destination action

Todd Main (JIRA) jira-events at jboss.com
Wed Sep 6 15:48:29 EDT 2006


Action method of source page being executed after destination action
--------------------------------------------------------------------

                 Key: JBSEAM-343
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-343
             Project: JBoss Seam
          Issue Type: Bug
          Components: JSF
    Affects Versions: 1.0.1
         Environment: Windows XP, jboss installation per Seam setup instructions
            Reporter: Todd Main


I keep having trouble where the "from" page action seems be getting executed when using the <s:link> tag. Here's one example:

Page "QuickClicks.xhtml" has a pages.xml entry with an action defined, so that the action gets called whenever I view "QuickClicks.xhtml".

   <page view-id="/QuickClicks.xhtml" action="#{quickClicks.load}"/>

There's an <s:link> on QuickClicks.xhtml that goes to a different session bean and displays a different xhtml page.

                            <s:link target="reportResultsFrame" view-id="/Documents.xhtml" action="#{findDocuments.search}">
                                <f:param name="dayRange" value="7" />
                                <f:param name="documentCategory" value="po" />
                                #{quickClicksData.ordersFromLastSeven}
                            </s:link>

When I click the link, the quickClicks.load() method is being invoked AFTER findDocuments.search().   It should not be invoked at all, since I'm coming FROM that page, not TO it.

Note: there is a posting in the Forum (see forum reference) that indicates a possible code fix for AbstractSeamPhaseListener.  Here is what was posted:

This seems to be happening in AbstractPhaseListener and looks like a bug. The code in question is

Code:

   
   public boolean callPageActions(PhaseEvent event)
   {
      Lifecycle.setPhaseId( PhaseId.INVOKE_APPLICATION );
      boolean actionsWereCalled = false;
      try
      {
         actionsWereCalled = Pages.callAction( event.getFacesContext() ) || actionsWereCalled;
         actionsWereCalled = Pages.instance().callAction() || actionsWereCalled;
         return actionsWereCalled;

The first "Pages.callAction(event.getFacesContext()) || actionsWereCalled " runs the intended action i.e. the action in the second page. Note that at this point, the view-id is still the first page as the lifecycle has not come into the "render" phase -- still in the "Execute" phase. Now that the method returned true, we are again invoking the Pages.instance().callAction() which calls the first view since the view-id is the first page. Thats the reason for the out of order of messages.

If the code were
Code:

    actionsWereCalled = Pages.callAction( event.getFacesContext() ) || actionsWereCalled;
    actionsWereCalled = actionsWereCalled || Pages.instance().callAction();
    return actionsWereCalled;
	


that should fix this.


-- 
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 jboss-jira mailing list