I have developed complex program to submit PDF/XFA to server-side ASP.NET program.
I need now to do the same using Java server-side program.
The approach I am following is to break down the long and complex form into smaller sections. Each section will be a separate XDP form in HTML5 format, and it will have the following common buttons:
- Jump to Section
I am looking for a simple example to explain how to submit a HTML5 form to a Java server-side program (JSP or Servlet) and how to retrieve the submitted XML or the form fields and values.
I did some effort, but still need some help. Please download the basic HTML5 XDP form from here. See snapshots below for more details. The code to submit is placed under the "Save" button, click event:
var theBtnSubmit = cmdSubmitForm.resolveNode("#event").submit;
var theTarget = form_config.server_url.rawValue + "?" + "action=save" + "&form_id=" + form_config.form_id.rawValue + "§ion_id=" + form_config.section_id.rawValue;
theBtnSubmit.target = theTarget;
The JSP is very simple. You can download it from here. I used the following lines of code to get the InputStream and convert to string:
ServletInputStream ris = request.getInputStream();
String theString = IOUtils.toString(ris);
I developed a simple Java program using JSP under a Dynamic Web Project.
On the server, I am unable to retrieve the form fields and values in XML format. What I am getting is the concatenated values of the fields which are filled.
The hidden Submit Button "cmdSubmitForm:
Finally, it worked. As a matter of fact, the above method is working fine. The only issue was that the string must be escaped for XML.
I add the following code, and I can now see the XML:
<%@page import="org.apache.commons.lang3.StringEscapeUtils" %>
String theString = IOUtils.toString(ris, Charset.forName("UTF-8"));
theString = StringEscapeUtils.escapeXml10(theString);
out.print("input stream in string format : " + theString + "<br/>");
Sorry Tussha for late reply.
At this stage, I won't be able to provide any feedback on HTML5 implementation under Adobe LiveCycle since long time has passed already.
Is there any way we can submit a form/fetch the xml from a HTML5 form, without using a hidden submit button?
Any help/sugestion is much appreciated.