Take a survey

Developing Applications Using APIs > Rendering Forms > Rendering Forms as HTML > Rendering a form as HTML using the web service API

Rendering a form as HTML using the web service API
To render an HTML form using the web service API, perform the following tasks:
1.
2.
Create a FormsService object and set authentication values.
3.
Create an HTMLRenderSpec object by using its constructor.
To render an HTML form with a toolbar, invoke the HTMLRenderSpec object’s setHTMLToolbar method and pass an HTMLToolbar enum value. For example, to display a vertical HTML toolbar, pass HTMLToolbar.Vertical.
To set the locale value for the HTML form, invoke the HTMLRenderSpec object’s setLocale method and pass a string value that specifies the locale value, For information about locale values, see LiveCycle ES API References.
To render the HTML form within full HTML tags, invoke the HTMLRenderSpec object’s setOutputType method and pass OutputType.FullHTMLTags.
Note: Forms are not successfully rendered in HTML when the StandAlone option is true and the ApplicationWebRoot references a server other than the J2EE application server hosting LiveCycle ES (the ApplicationWebRoot value is specified using the URLSpec object that is passed to the FormsServiceClient object’s renderHTMLForm method). When the ApplicationWebRoot is another server from the one hosting LiveCycle ES, the value of the web root URI in the LiveCycle Administration Console needs to be set as the Form's web application URI value. This can be done by logging in to the LiveCycle Administration Console, clicking Services > LiveCycle Forms ES, and setting the Web Root URI as http://server-name:port/FormServer. Then, save your settings.
4.
Invoke the FormsService object’s renderHTMLForm method and pass the following values:
A string value that specifies the form design name, including the file name extension. If you are referencing a form design that is saved in the repository, ensure that you specify the / character before the file name.
A TransformTo enum value that specifies the HTML preference type. For example, to render an HTML form that is compatible with dynamic HTML for Internet Explorer 5.0 or later, specify TransformTo.MSDHTML.
A BLOB object that contains data to merge with the form. If you do not want to merge data, then pass null. For information, see Prepopulating Dynamic Forms.
The HTMLRenderSpec object that stores HTML run-time options.
A string value that specifies the HTTP_USER_AGENT header value; for example, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322). You can pass an empty string if you do not want to set this value.
A URLSpec object that stores URI values required to render an HTML form. For information, see Specify URI values.
A java.util.HashMap object that stores file attachments. This is an optional parameter and you can specify null if you do not want to attach files to the form. For information, see Attach files to the form.
An empty com.adobe.idp.services.holders.BLOBHolder object that is populated by the method. This parameter value stores the rendered form.
An empty com.adobe.idp.services.holders.BLOBHolder object that is populated by the method. This parameter will store the output XML data.
An empty javax.xml.rpc.holders.LongHolder object that is populated by the method. This argument will store the number of pages in the form.
An empty javax.xml.rpc.holders.StringHolder object that is populated by the method. This argument will store the locale value.
An empty javax.xml.rpc.holders.StringHolder object that is populated by the method. This argument will store the HTML rendering value that is used.
An empty com.adobe.idp.services.holders.FormsResultHolder object that will contain the results of this operation.
The renderHTMLForm method populates the com.adobe.idp.services.holders.FormsResultHolder object that is passed as the last argument value with a form data stream that must be written to the client web browser.
5.
Create a FormResult object by getting the value of the com.adobe.idp.services.holders.FormsResultHolder object’s value data member.
Create a BLOB object that contains form data by invoking the FormsResult object’s getOutputContent method.
Get the content type of the BLOB object by invoking its getContentType method.
Set the javax.servlet.http.HttpServletResponse object’s content type by invoking its setContentType method and passing the content type of the BLOB object.
Create a javax.servlet.ServletOutputStream object used to write the form data stream to the client web browser by invoking the javax.servlet.http.HttpServletResponse object’s getOutputStream method.
Create a byte array and populate it by invoking the BLOB object’s getBinaryData method. This task assigns the content of the FormsResult object to the byte array.
Invoke the javax.servlet.http.HttpServletResponse object’s write method to send the form data stream to the client web browser. Pass the byte array to the write method.
View Quick Start
 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/renderingHTML.38.10.html