Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.components
Class Submit

    java.lang.Object
      org.apache.struts2.components.Component
          org.apache.struts2.components.UIBean
              org.apache.struts2.components.FormButton
                  org.apache.struts2.components.Submit

All Implemented Interfaces:
  RemoteUICallBean

    public class Submit

extends FormButton
implements RemoteUICallBean

Render a submit button. The submit tag is used together with the form tag to provide asynchronous form submissions. The submit can have three different types of rendering:

- input: renders as html <input type="submit"...>
- image: renders as html <input type="image"...>
- button: renders as html <button type="submit"...>

Please note that the button type has advantages by adding the possibility to seperate the submitted value from the text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0

Examples

     <s:submit value="%{'Submit'}" />

     Render an image submit:
     <s:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/>

     Render an button submit:
     <s:submit type="button" value="%{'Submit'}" label="Submit the form"/>

THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED

- href
- errorText
- listenTopics
- notifyTopics
- executeScripts
- loadingText
- listenTopics
- handler
- formId
- formFilter
- targets
- showErrorTransportText
- targets
- indicator

'resultDivId' Deprecated. Use targets. 'targets' is a list of element ids whose content will be updated with the text returned from request.

'errorText' is the text that will be displayed when there is an error making the request.

'onLoadJS' Deprecated. Use 'notifyTopics'.

'preInvokeJS' Deprecated. Use 'notifyTopics'.

'executeScripts' if set to true will execute javascript sections in the returned text.

'loadingText' is the text that will be displayed on the 'targets' elements while making the request.

'handler' is the name of the function that will take care of making the AJAX request. Dojo's widget and dom node are passed as parameters).

'formId' is the id of the html form whose fields will be seralized and passed as parameters in the request.

'formFilter' is the name of a function which will be used to filter the fields that will be seralized. This function takes as a parameter the element and returns true if the element should be included.

'listenTopics' comma separated list of topics names, that will trigger a request 'indicator' element to be shown while the request executing 'showErrorTransportText': whether errors should be displayed (on 'targets') 'showLoadingText' show loading text on targets 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:

- data: html or json object when type='load' or type='error'
- type: 'before' before the request is made, 'load' when the request succeeds, or 'error' when it fails
- request: request javascript object, when type='load' or type='error'

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:

     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 >

Field Summary
`protected String` | `afterLoading`
`protected String` | `beforeLoading`
`protected String` | `errorText`
`protected String` | `executeScripts`
`protected String` | `formFilter`
`protected String` | `formId`
`protected String` | `handler`
`protected String` | `href`
`protected String` | `indicator`
`protected String` | `listenTopics`
`protected String` | `loadingText`
`private static Log` | `LOG`
`protected String` | `notifyTopics`
`protected String` | `showErrorTransportText`
`protected String` | `showLoadingText`
`protected String` | `src`
`protected String` | `targets`
`static String` | `TEMPLATE`

Fields inherited from class org.apache.struts2.components.FormButton
`action, align, BUTTONTYPE_BUTTON, BUTTONTYPE_IMAGE, BUTTONTYPE_INPUT, method, type`

Fields inherited from class org.apache.struts2.components.UIBean
`accesskey, cssClass, cssStyle, defaultTemplateDir, defaultUITheme, disabled, key, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, value`

Fields inherited from class org.apache.struts2.components.Component
`actionMapper, COMPONENT_STACK, id, parameters, stack`

Constructor Summary
`Submit(ValueStack stack, HttpServletRequest request, HttpServletResponse response)`

Method Summary
`boolean` | `end(Writer writer, String body)` Overrides to be able to render body in a template rather than always before the template
`void` | `evaluateExtraParams()`
`void` | `evaluateParams()`
`protected String` | `getDefaultTemplate()` A contract that requires each concrete UI Tag to specify which template should be used as a default.
`void` | `setAfterLoading(String afterLoading)`
`void` | `setBeforeLoading(String beforeLoading)`
`void` | `setErrorText(String errorText)`
`void` | `setExecuteScripts(String executeScripts)`
`void` | `setFormFilter(String formFilter)`
`void` | `setFormId(String formId)`
`void` | `setHandler(String handler)`
`void` | `setHref(String href)`
`void` | `setIndicator(String indicator)`
`void` | `setListenTopics(String listenTopics)`
`void` | `setLoadingText(String loadingText)`
`void` | `setNotifyTopics(String notifyTopics)`
`void` | `setShowErrorTransportText(String showErrorTransportText)`
`void` | `setShowLoadingText(String showLoadingText)`
`void` | `setSrc(String src)`
`void` | `setTargets(String targets)`
`void` | `setTheme(String theme)`
`protected boolean` | `supportsImageType()` Indicate whether the concrete button supports the type "image".

Methods inherited from class org.apache.struts2.components.FormButton
`populateComponentHtmlId, setAction, setAlign, setMethod, setType`

Methods inherited from class org.apache.struts2.components.UIBean
`addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, escape, evaluateNameValue, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, setAccesskey, setCssClass, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setKey, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setValue`

Methods inherited from class org.apache.struts2.components.Component
`addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setActionMapper, setId, start, toString, usesBody`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOG

    private static final Log LOG

### TEMPLATE

    public static final String TEMPLATE

See Also:
  Constant Field Values

### href

    protected String href

### errorText

    protected String errorText

### executeScripts

    protected String executeScripts

### loadingText

    protected String loadingText

### listenTopics

    protected String listenTopics

### handler

    protected String handler

### formId

    protected String formId

### formFilter

    protected String formFilter

### src

    protected String src

### notifyTopics

    protected String notifyTopics

### showErrorTransportText

    protected String showErrorTransportText

### indicator

    protected String indicator

### showLoadingText

    protected String showLoadingText

### beforeLoading

    protected String beforeLoading

### afterLoading

    protected String afterLoading

### targets

    protected String targets

Constructor Detail

### Submit

    public Submit(ValueStack stack,
                  HttpServletRequest request,
                  HttpServletResponse response)

Method Detail

### getDefaultTemplate

    protected String getDefaultTemplate()

  Description copied from class: `UIBean`
  A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

  Specified by:
    `getDefaultTemplate` in class `UIBean`
  Returns:
    The name of the template to be used as the default.

### evaluateParams

    public void evaluateParams()

  Overrides:
    `evaluateParams` in class `UIBean`

### evaluateExtraParams

    public void evaluateExtraParams()

  Overrides:
    `evaluateExtraParams` in class `FormButton`

### supportsImageType

    protected boolean supportsImageType()

  Indicate whether the concrete button supports the type "image".

  Specified by:
    `supportsImageType` in class `FormButton`
  Returns:
    `true` to indicate type image is supported.

### end

    public boolean end(Writer writer,
                       String body)

  Overrides to be able to render body in a template rather than always before the template

  Overrides:
    `end` in class `UIBean`
  Parameters:
    `writer` - the output writer.
    `body` - the rendered body.
  Returns:
    true if the body should be evaluated again

### setListenTopics

    public void setListenTopics(String listenTopics)

  Specified by:
    `setListenTopics` in interface `RemoteUICallBean`

### setTheme

    public void setTheme(String theme)

  Overrides:
    `setTheme` in class `UIBean`

### setHref

    public void setHref(String href)

  Specified by:
    `setHref` in interface `RemoteUICallBean`

### setErrorText

    public void setErrorText(String errorText)

  Specified by:
    `setErrorText` in interface `RemoteUICallBean`

### setAfterLoading

    public void setAfterLoading(String afterLoading)

  Specified by:
    `setAfterLoading` in interface `RemoteUICallBean`

### setBeforeLoading

    public void setBeforeLoading(String beforeLoading)

  Specified by:
    `setBeforeLoading` in interface `RemoteUICallBean`

### setExecuteScripts

    public void setExecuteScripts(String executeScripts)

  Specified by:
    `setExecuteScripts` in interface `RemoteUICallBean`

### setLoadingText

    public void setLoadingText(String loadingText)

  Specified by:
    `setLoadingText` in interface `RemoteUICallBean`

### setHandler

    public void setHandler(String handler)

  Specified by:
    `setHandler` in interface `RemoteUICallBean`

### setFormFilter

    public void setFormFilter(String formFilter)

  Specified by:
    `setFormFilter` in interface `RemoteUICallBean`

### setFormId

    public void setFormId(String formId)

  Specified by:
    `setFormId` in interface `RemoteUICallBean`

### setSrc

    public void setSrc(String src)

### setTargets

    public void setTargets(String targets)

### setNotifyTopics

    public void setNotifyTopics(String notifyTopics)

  Specified by:
    `setNotifyTopics` in interface `RemoteUICallBean`

### setShowErrorTransportText

    public void setShowErrorTransportText(String showErrorTransportText)

  Specified by:
    `setShowErrorTransportText` in interface `RemoteUICallBean`

### setIndicator

    public void setIndicator(String indicator)

  Specified by:
    `setIndicator` in interface `RemoteUICallBean`

### setShowLoadingText

    public void setShowLoadingText(String showLoadingText)

  Specified by:
    `setShowLoadingText` in interface `RemoteUICallBean`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.