2 Replies Latest reply on May 1, 2007 2:14 PM by Saeed Iqbal

    s:link invoking page action for CURRENT page during postback

    John Chesher Newbie

      Scenario:
      Page A contains an s:link to go to page B. Page A has a page action defined in pages.xml. From Page A, when I click on the s:link to go to Page B, it invokes the page action for Page A before redirecting to Page B.

      I have this scenario in multiple instances within my application. In most cases, I didn't even realize that it was invoking the page action for Page A, as by luck the method was designed such that it did not throw an exception or cause any other noticeable problems. However, I finally noticed this behavior when my luck ran out and I wrote a page action method that threw an exception when called unitentionally in this situation.

      I have since added conditional logic to the page action method to keep it from throwing an exception in this case, while still providing the needed functionality when called "intentionally", i.e., when the page it is associated with is actually going to be rendered. However, unless there is a possible benefit to this that I am not aware of, it would appear that the page action should not be invoked and is performing unnecessary and undesired work.

      Is this perhaps a bug in s:link or am I not properly understanding and utilizing its capabilities?
      Thanks!