Hi experience-manager-forum
An example of submit to REST endpoint below.
Create a new servlet and update the package name:
package com.<name of your package>;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import java.io.IOException;
@Component(
service = Servlet.class,
property = {
"sling.servlet.paths=/bin/submitServlet",
"sling.auth.requirements=-/bin/submitServlet"
}
)
public class SubmitServlet extends SlingAllMethodsServlet {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException {
String dataXML = request.getParameter("dataXml");
logger.info("Data submitted " + dataXML);
}
}
Set the properties on your adaptive form container as follows, make sure Enable Post is ticked, and make sure the servlet path matches what you defined in your servlet.

Hit the submit button and you should see that the "dataXml" parameter contains your submitted form data and the "attachments" parameter contains your attached file:


If this doesn't work, do you have the aem forms add on packages installed? You should install that and it's dependencies via package share if not.