java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.UIBean
org.apache.struts2.components.ClosingUIBean
All Implemented Interfaces:
ButtonBean

public class Submit extends AbstractRemoteBean implements ButtonBean

Renders a submit button that can submit a form asynchronously. 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 separate 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

 <sj:submit value="%{'Submit'}" />
 
 <sj:submit type="image" value="%{'Submit'}" label="Submit the form" src="submit.gif"/>
 
 <sj:submit type="button" value="%{'Submit'}" label="Submit the form"/>
 
 <div id="div1">Div 1</div>
 <s:url id="ajaxTest" value="/AjaxTest.action"/>
 <sj:submit id="link1" href="%{ajaxTest}" target="div1" />
 
 <s:form id="form" action="AjaxTest">
 <input type="textbox" name="data"> <sj:submit />
 </s:form>
 
 <s:form id="form" action="AjaxTest">
 <input type="textbox" name="data">
 </s:form>

 <sj:submit formId="form" />
 
 <script type="text/javascript">
 function before(event){ alert('before request'); };
 function complete(event){ alert('after request'); };
 </script>

 <sj:submit beforeSend="before()" complete="complete()" />
 
 <sj:submit value"AJAX Submit with effect"
 effect="highlight" effectOptions="color : '#222222'"
 effectDuration="3600"> href="%{#ajaxTest}" />
 
Author:
Johannes Geppert
  • Field Details

    • TEMPLATE

      public static final String TEMPLATE
      See Also:
    • TEMPLATE_CLOSE

      public static final String TEMPLATE_CLOSE
      See Also:
    • JQUERYACTION

      public static final String JQUERYACTION
      See Also:
    • COMPONENT_NAME

      public static final String COMPONENT_NAME
    • src

      protected String src
    • type

      protected String type
    • clearForm

      protected String clearForm
    • resetForm

      protected String resetForm
    • iframe

      protected String iframe
    • onClickTopics

      protected String onClickTopics
    • openDialog

      protected String openDialog
    • openDialogTitle

      protected String openDialogTitle
    • parentTheme

      protected String parentTheme
    • button

      protected String button
    • buttonIcon

      protected String buttonIcon
    • buttonIconSecondary

      protected String buttonIconSecondary
    • buttonText

      protected String buttonText
    • validate

      protected String validate
    • validateFunction

      protected String validateFunction
    • formFilter

      protected String formFilter
    • replaceTarget

      protected String replaceTarget
  • Constructor Details

    • Submit

      public Submit(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
  • Method Details

    • getDefaultOpenTemplate

      public String getDefaultOpenTemplate()
      Specified by:
      getDefaultOpenTemplate in class org.apache.struts2.components.ClosingUIBean
    • getDefaultTemplate

      protected String getDefaultTemplate()
      Specified by:
      getDefaultTemplate in class org.apache.struts2.components.UIBean
    • getComponentName

      public String getComponentName()
    • evaluateParams

      public void evaluateParams()
      Overrides:
      evaluateParams in class org.apache.struts2.components.UIBean
    • evaluateExtraParams

      public void evaluateExtraParams()
      Overrides:
      evaluateExtraParams in class AbstractRemoteBean
    • setTheme

      public void setTheme(String theme)
      Overrides:
      setTheme in class org.apache.struts2.components.UIBean
    • getTheme

      public String getTheme()
      Overrides:
      getTheme in class org.apache.struts2.components.UIBean
    • supportsImageType

      protected boolean supportsImageType()
      Indicate whether the concrete button supports the type "image".
      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 org.apache.struts2.components.UIBean
    • setType

      public void setType(String type)
    • setSrc

      public void setSrc(String src)
    • setClearForm

      public void setClearForm(String clearForm)
    • setResetForm

      public void setResetForm(String resetForm)
    • setIframe

      public void setIframe(String iframe)
    • setOnClickTopics

      public void setOnClickTopics(String onClickTopics)
    • setOpenDialog

      public void setOpenDialog(String openDialog)
    • setOpenDialogTitle

      public void setOpenDialogTitle(String openDialogTitle)
    • setParentTheme

      public void setParentTheme(String parentTheme)
    • setButton

      public void setButton(String button)
      Specified by:
      setButton in interface ButtonBean
    • setButtonIcon

      public void setButtonIcon(String buttonIcon)
      Specified by:
      setButtonIcon in interface ButtonBean
    • setButtonIconSecondary

      public void setButtonIconSecondary(String buttonIconSecondary)
      Specified by:
      setButtonIconSecondary in interface ButtonBean
    • setButtonText

      public void setButtonText(String buttonText)
      Specified by:
      setButtonText in interface ButtonBean
    • setValidateFunction

      public void setValidateFunction(String validateFunction)
    • setValidate

      public void setValidate(String validate)
    • setFormFilter

      public void setFormFilter(String formFilter)
    • setReplaceTarget

      public void setReplaceTarget(String replaceTarget)