Hi Paul,

Just override invokeAction() and if the result is null then no action matched 
the URL.  That is your queue to set a conditional boolean to cause the 
informational message to be shown.

Chuck


From: <[email protected]> on behalf of 
Paul Hoadley <[email protected]>
Date: Monday, July 11, 2016 at 12:40 AM
To: WebObjects-Dev <[email protected]>
Subject: Intercepting a failed action method invocation

Hello,

I have a page structure where a form submit button is conditionally rendered 
based on some property of an EO. Sometimes the page will be returned such that 
the submit button is displayed, but meanwhile the value of the property changes 
behind the page’s back. At this point, clicking on the submit button doesn’t 
invoke the action method, but returns the same page (now with the submit button 
excluded by the conditional). It’s just as easy to demonstrate this with a 
WOHyperlink—the behaviour is the same:

    <wo:if condition="$showLink">
      <div>
        <wo:link action="$linkAction">Link!</wo:link>
      </div>
    </wo:if>

Then:

private boolean showLink = true;

public boolean showLink() {
if (showLink) {
showLink = false;
return true;
}
return showLink;
}

public WOActionResults linkAction() {
System.out.println("Main.linkAction: CALLED");
return null;
}

The hyperlink is rendered on initial page load, but then never again, and the 
action method is never called in response to clicking the hyperlink displayed 
on initial load.

I think this behaviour is quite reasonable, but I want to intercept it so that 
I can add an informational message to the page that explains what’s going on. 
Is there an obvious way to do this?


--
Paul Hoadley
http://logicsquad.net/




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to