Class SubmitButton<T extends SubmitButton<T>>


public class SubmitButton<T extends SubmitButton<T>> extends Input<T>
HTML submit button input element for form submission.

This class extends Input to provide a submit button control that triggers form submission. Supports HTML5 form attributes that can override the form's action, encoding, method, and target.

Features:

  • Form submission trigger
  • Customizable button text via value attribute
  • Override form action, method, encoding, and target
  • HTML5 form attribute support

Usage:

 SubmitButton submit = new SubmitButton("Submit");
 submit.setFormAction("/alternative-endpoint");
 submit.setFormMethod(FormMethod.POST);
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • SubmitButton

      public SubmitButton()
      Constructs a submit button with default "submit" text.
    • SubmitButton

      public SubmitButton(String text)
      Constructs a submit button with the specified text.
      Parameters:
      text - The button text.
  • Method Details

    • setFormAction

      public final T setFormAction(String url)
      Sets the formaction attribute.

      Overrides the form's action attribute for this specific submit button. Used on <input> elements with type="submit" or type="image". The value specifies the URL to submit the form data to.

      If the URL starts with "/" (absolute path within the application), the servlet context path will be automatically prepended.

      Overrides:
      setFormAction in class InputElement<T extends SubmitButton<T>>
      Parameters:
      url - The URL for form submission.
      Returns:
      This element for method chaining.
    • setFormEncType

      public final T setFormEncType(FormEncoding encoding)
      Sets the form encoding type override using the FormEncoding enum.
      Overrides:
      setFormEncType in class InputElement<T extends SubmitButton<T>>
      Parameters:
      encoding - The encoding type.
      Returns:
      This element for method chaining.
    • setFormEncType

      public final T setFormEncType(String encoding)
      Sets the formenctype attribute.

      Overrides the form's enctype attribute for this specific submit button. Used on <input> elements with type="submit" or type="image".

      Overrides:
      setFormEncType in class InputElement<T extends SubmitButton<T>>
      Parameters:
      encoding - The encoding type for form submission.
      Returns:
      This element for method chaining.
    • setFormMethod

      public final T setFormMethod(FormMethod method)
      Sets the form method override using the FormMethod enum.
      Overrides:
      setFormMethod in class InputElement<T extends SubmitButton<T>>
      Parameters:
      method - The HTTP method (GET or POST).
      Returns:
      This element for method chaining.
    • setFormMethod

      public final T setFormMethod(String method)
      Sets the formmethod attribute.

      Overrides the form's method attribute for this specific submit button. Used on <input> elements with type="submit" or type="image".

      Overrides:
      setFormMethod in class InputElement<T extends SubmitButton<T>>
      Parameters:
      method - The HTTP method for form submission (get, post).
      Returns:
      This element for method chaining.
    • setFormTarget

      public final T setFormTarget(Target target)
      Sets the form target override using the Target enum.
      Overrides:
      setFormTarget in class InputElement<T extends SubmitButton<T>>
      Parameters:
      target - The browsing context for form submission.
      Returns:
      This element for method chaining.
    • setFormTarget

      public final T setFormTarget(String target)
      Sets the formtarget attribute.

      Overrides the form's target attribute for this specific submit button, specifying where to display the response. Used on <input> elements with type="submit" or type="image". Values include "_self", "_blank", "_parent", and "_top".

      Overrides:
      setFormTarget in class InputElement<T extends SubmitButton<T>>
      Parameters:
      target - The browsing context for form submission.
      Returns:
      This element for method chaining.