You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by gw...@apache.org on 2007/09/09 15:11:08 UTC
svn commit: r574010 -
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
Author: gwynevans
Date: Sun Sep 9 06:11:08 2007
New Revision: 574010
URL: http://svn.apache.org/viewvc?rev=574010&view=rev
Log:
Added Martijn's AjaxFallback background/explanation to the JavaDoc
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java?rev=574010&r1=574009&r2=574010&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java Sun Sep 9 06:11:08 2007
@@ -29,6 +29,35 @@
* constructor argument it does not need to be inside form's component
* hierarchy.
*
+ * <p/>
+ * It works by splitting the javascript/Ajax calls from the normal
+ * non-ajax requests by generating:
+ * <pre>
+ * <a href="normal action url" onclick="ajax javascript script; return
+ * false;">link</a>
+ * </pre>
+ * If/when javascript is turned off in the browser, or it doesn't support
+ * javascript, then the browser will not respond to the onclick event,
+ * using the href directly. Wicket will then use a normal request target,
+ * and call the serverside onClick with a null {@link AjaxRequestTarget}.
+ *
+ * If javascript is enabled, Wicket will send an ajax request, and
+ * process it serverside with an {@link AjaxRequestTarget} that is supplied to
+ * the server-side onClick method. The "return false" in the <a href>
+ * onclick handler ensures the browser doesn't perform the normal request
+ * too.
+ *
+ * The latter is nicely illustrated with this:
+ * <pre>
+ * <a href="javascript:alert('href event handler');"
+ * onclick="alert('onclick event handler');">clicking me gives two
+ * alerts</a>
+ *
+ * <a href="javascript:alert('href event handler');"
+ * onclick="alert('onclick event handler');return false;">clicking me
+ * gives only one alert</a>
+ * </pre>
+ *
* @since 1.2
*
* @author Igor Vaynberg (ivaynberg)