Example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes setSubmittingComponentName

List of usage examples for org.apache.wicket.ajax.attributes AjaxRequestAttributes setSubmittingComponentName

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes setSubmittingComponentName.

Prototype

public AjaxRequestAttributes setSubmittingComponentName(String submittingComponentName) 

Source Link

Usage

From source file:name.martingeisse.wicket.component.stateless.StatelessAjaxFormSubmitBehavior.java

License:Apache License

@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
    super.updateAjaxAttributes(attributes);

    final Form<?> form = getForm();
    attributes.setFormId(form.getMarkupId());

    final String formMethod = form.getMarkupAttributes().getString("method");
    if (formMethod == null || "POST".equalsIgnoreCase(formMethod)) {
        attributes.setMethod(Method.POST);
    }//from   w  w  w .  j av a2 s. c  om

    if (form.getRootForm().isMultiPart()) {
        attributes.setMultipart(true);
        attributes.setMethod(Method.POST);
    }

    if (getComponent() instanceof IFormSubmittingComponent) {
        final String submittingComponentName = ((IFormSubmittingComponent) getComponent()).getInputName();
        attributes.setSubmittingComponentName(submittingComponentName);
    }
}