mirror of
https://github.com/apache/struts.git
synced 2026-09-01 03:44:30 +00:00
Improve submit tag documentation
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@542718 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.components.Form;
|
||||
import org.apache.struts2.components.FormButton;
|
||||
import org.apache.struts2.interceptor.validation.SkipValidation;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
@@ -38,7 +37,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* Render a submit button. The submit tag is used together with the form tag to provide asynchronous form submissions.
|
||||
* Renders a submit button that can submit a form asynchronously.
|
||||
* The submit can have three different types of rendering:
|
||||
* <ul>
|
||||
* <li>input: renders as html <input type="submit"...></li>
|
||||
@@ -49,50 +48,103 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* <p/> <b>Examples</b>
|
||||
* <p>Examples</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <s:submit value="%{'Submit'}" />
|
||||
* <!-- END SNIPPET: example -->
|
||||
* <!-- START SNIPPET: example1 -->
|
||||
* <sx:submit value="%{'Submit'}" />
|
||||
* <!-- END SNIPPET: example1 -->
|
||||
* </pre>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example2 -->
|
||||
* Render an image submit:
|
||||
* <s:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/>
|
||||
* <sx:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/>
|
||||
* <!-- END SNIPPET: example2 -->
|
||||
* </pre>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example3 -->
|
||||
* Render an button submit:
|
||||
* <s:submit type="button" value="%{'Submit'}" label="Submit the form"/>
|
||||
* <sx:submit type="button" value="%{'Submit'}" label="Submit the form"/>
|
||||
* <!-- END SNIPPET: example3 -->
|
||||
* </pre>
|
||||
*
|
||||
* <!-- START SNIPPET: ajxExDescription1 -->
|
||||
* Show the results in another div. If you want your results to be shown in
|
||||
* a div, use the resultDivId where the id is the id of the div you want them
|
||||
* shown in. This is an inner HTML approah. Your results get jammed into
|
||||
* the div for you. Here is a sample of this approach:
|
||||
* <!-- END SNIPPET: ajxExDescription1 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example4 -->
|
||||
* <p>Update target content with html returned from an action:</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: ajxExample1 -->
|
||||
* Remote form replacing another div:
|
||||
* <div id='two' style="border: 1px solid yellow;">Initial content</div>
|
||||
* <s:form
|
||||
* id='theForm2'
|
||||
* cssStyle="border: 1px solid green;"
|
||||
* action='/AjaxRemoteForm.action'
|
||||
* method='post'
|
||||
* theme="ajax">
|
||||
*
|
||||
* <input type='text' name='data' value='Struts User' />
|
||||
* <s:submit value="GO2" theme="ajax" resultDivId="two" />
|
||||
*
|
||||
* </s:form >
|
||||
* <!-- END SNIPPET: ajxExample1 -->
|
||||
* <div id="div1">Div 1</div>
|
||||
* <s:url id="ajaxTest" value="/AjaxTest.action"/>
|
||||
*
|
||||
* <sx:submit id="link1" href="%{ajaxTest}" target="div1" />
|
||||
* </pre>
|
||||
*
|
||||
* <!-- END SNIPPET: example4 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example5 -->
|
||||
* <p>Submit form(inside the form):</p>
|
||||
* <pre>
|
||||
* <s:form id="form" action="AjaxTest">
|
||||
* <input type="textbox" name="data">
|
||||
* <sx:submit />
|
||||
* </s:form>
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example5 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example6 -->
|
||||
* <p>Submit form(outside the form)</p>
|
||||
* <pre>
|
||||
* <s:form id="form" action="AjaxTest">
|
||||
* <input type="textbox" name="data">
|
||||
* </s:form>
|
||||
*
|
||||
* <sx:submit formId="form" />
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example6 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example7 -->
|
||||
* <p>Using beforeNotifyTopics:</p>
|
||||
* <pre>
|
||||
* <script type="text/javascript">
|
||||
* dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
* alert('inside a topic event. before request');
|
||||
* //event: set event.cancel = true, to cancel request
|
||||
* //widget: widget that published the topic
|
||||
* });
|
||||
* </script>
|
||||
*
|
||||
* <sx:submit beforeNotifyTopics="/before" />
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example7 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example8 -->
|
||||
* <p>Using afterNotifyTopics and highlight target:</p>
|
||||
* <pre>
|
||||
* <script type="text/javascript">
|
||||
* dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
* alert('inside a topic event. after request');
|
||||
* //data : text returned from request(the html)
|
||||
* //request: XMLHttpRequest object
|
||||
* //widget: widget that published the topic
|
||||
* });
|
||||
* </script>
|
||||
*
|
||||
* <sx:submit afterNotifyTopics="/after" highlightColor="red" href="%{#ajaxTest}" />
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example5 -->
|
||||
*
|
||||
* <!-- START SNIPPET: example6 -->
|
||||
* <p>Using errorNotifyTopics and indicator:</p>
|
||||
* <pre>
|
||||
* <script type="text/javascript">
|
||||
* dojo.event.topic.subscribe("/error", function(error, request, widget){
|
||||
* alert('inside a topic event. on error');
|
||||
* //error : error object (error.message has the error message)
|
||||
* //request: XMLHttpRequest object
|
||||
* //widget: widget that published the topic
|
||||
* });
|
||||
* </script>
|
||||
*
|
||||
* <img id="ind1" src="${pageContext.request.contextPath}/images/indicator.gif" style="display:none"/>
|
||||
* <sx:submit errorNotifyTopics="/error" indicator="ind1" href="%{#ajaxTest}" />
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example6 -->
|
||||
*/
|
||||
@StrutsTag(name="submit", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.SubmitTag", description="Render a submit button")
|
||||
public class Submit extends FormButton implements RemoteBean {
|
||||
|
||||
Reference in New Issue
Block a user