You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/03/24 14:30:19 UTC
svn commit: r522027 -
/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
Author: musachy
Date: Sat Mar 24 06:30:18 2007
New Revision: 522027
URL: http://svn.apache.org/viewvc?view=rev&rev=522027
Log:
WW-1607 Improve anchor's javadoc
Modified:
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java?view=diff&rev=522027&r1=522026&r2=522027
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java Sat Mar 24 06:30:18 2007
@@ -31,57 +31,54 @@
/**
* <!-- START SNIPPET: javadoc -->
- *
- * A tag that creates a HTML <a href='' /> that when clicked calls a URL remote XMLHttpRequest call via the dojo
- * framework.<p/>
- *<!-- END SNIPPET: javadoc -->
- * <p/> <b>Examples</b>
- *
- * <pre>
- * <!-- START SNIPPET: example1 -->
- * <s:a id="link1" theme="ajax" href="/DoIt.action" errorText="An error ocurred" loadingText="Loading...">
- * <img border="none" src="<%=request.getContextPath()%>/images/delete.gif"/>
- * <s:param name="id" value="1"/>
- * </s:a>
- * <!-- END SNIPPET: example1 -->
- * </pre>
- *
- * </p>
- *
- * <!-- START SNIPPET: exampledescription1 -->
- *
- * Results in
- *
- * <!-- END SNIPPET: exampledescription1 -->
- *
- * </p>
- *
- * <pre>
- * <!-- START SNIPPET: example2 -->
- * <a dojoType="BindAnchor" executeScripts="true" id="link1" href="/DoIt.action?id=1" errorText="An error ocurred"></a>
- * <!-- END SNIPPET: example2 -->
- * </pre>
- *
- * </p>
- *
- * <!-- START SNIPPET: exampledescription2 -->
- *
- * Here is an example that uses the beforeLoading. This example is in altSyntax=true:
- *
- * <!-- END SNIPPET: exampledescription2 -->
- *
+ * <p>
+ * A tag that creates an HTML <a/> element, that when clicked makes an asynchronous request(XMLHttpRequest). The url
+ * attribute must be build using the <s:url/> tag.
* </p>
- *
+ * <!-- END SNIPPET: javadoc -->
* <pre>
- * <!-- START SNIPPET: example3 -->
- * <s:a id="test" theme="ajax" href="/simpeResult.action" beforeLoading="confirm('Are you sure?')">
- * A
- * </s:a>
- * <!-- END SNIPPET: example3 -->
+ * <!-- START SNIPPET: examples -->
+ * <b>Update target content with html returned from an action:</b>
+ *
+ * <div id="div1">Div 1</div>
+ * <s:url id="ajaxTest" value="/AjaxTest.action"/>
+ *
+ * <sx:a id="link1" href="%{ajaxTest}" target="div1">
+ * Update Content
+ * </sx:a>
+ *
+ * <b>Submit form(anchor inside the form):</b>
+ *
+ * <s:form id="form" action="AjaxTest">
+ * <input type="textbox" name="data">
+ * <sx:a>Submit form</s:a>
+ * </s:form>
+ *
+ * <b>Submit form(anchor outside the form)</b>
+ *
+ * <s:form id="form" action="AjaxTest">
+ * <input type="textbox" name="data">
+ * </s:form>
+ *
+ * <sx:a formId="form">Submit form</sx:a>
+ *
+ * <b>Using topics:</b>
+ * <script type="text/javascript">
+ * dojo.event.topic.subscribe("/before", function(data, type, e){
+ * alert('inside a topic event. before request');
+ * //data : source element id
+ * //type : "before"
+ * //e : request object
+ * //set e.cancel = true to cancel request
+ * });
+ * </script>
+ *
+ * <sx:a beforeNotifyTopics="/before">Publish topics</s:a>
+ * <!-- END SNIPPET: examples -->
* </pre>
- *
*/
-@StrutsTag(name="a", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets")
+@StrutsTag(name="a", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.AnchorTag", description="Renders an HTML anchor element that when clicked calls a URL via remote XMLHttpRequest and updates " +
+ "its targets content")
public class Anchor extends AbstractRemoteCallUIBean {
public static final String OPEN_TEMPLATE = "a";
public static final String TEMPLATE = "a-close";