Summary of steps
To render an HTML form that contains a custom toolbar, perform these tasks:
- Include project files.
- Create a Forms Java API object.
- Reference a custom fscmenu XML file.
- Render an HTML form.
- Write the form data stream to the client web browser.
Include project files
Include the necessary files in your development project. If you are creating a client application by using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create a Forms Java API object
Before you can programmatically perform an operation that the Forms service supports, you must create a Forms client object.
Reference a custom fscmenu XML file
To render an HTML form that contains a custom toolbar, reference a fscmenu XML file that describes the toolbar. (This section provides two examples of a fscmenu XML file.) Also, ensure that the fscmenu.xml file specifies the locations of all referenced files correctly. As mentioned earlier in this section, ensure that all files are referenced by either the FSToolBarURI
keyword or their absolute locations.
Render an HTML form
To render an HTML form, specify a form design that was created in Designer and saved as an XDP file. Also select an HTML transformation type. For example, you can specify the HTML transformation type that renders a dynamic HTML for Internet Explorer 5.0 or later.
Rendering an HTML form also requires values, such as URI values for rendering other form types.
Write the form data stream to the client web browser
When the Forms service renders an HTML form, it returns a form data stream that you must write to the client web browser to make the HTML form visible to users.
See also
Render an HTML Form with a custom toolbar using the Java API
Rendering an HTML Form with a custom toolbar using the web service API
Including AEM Forms Java library files
Forms Service API Quick Starts
Render an HTML Form with a custom toolbar using the Java API
Render an HTML Form that contains a custom toolbar by using the Forms Service API (Java):
-
Include project files
Include client JAR files, such as adobe-forms-client.jar, in your Java project’s class path.
-
Create a Forms Java API object
- Create a
ServiceClientFactory
object that contains connection properties. - Create a
FormsServiceClient
object by using its constructor and passing theServiceClientFactory
object.
- Create a
-
Reference a custom fscmenu XML file
- Create an
HTMLRenderSpec
object by using its constructor. - To render an HTML form with a toolbar, invoke the
HTMLRenderSpec
object’ssetHTMLToolbar
method and pass anHTMLToolbar
enum value. For example, to display a vertical HTML toolbar, passHTMLToolbar.Vertical
. - Specify the location of the fscmenu XML file by invoking the
HTMLRenderSpec
object’ssetToolbarURI
method and passing a string value that specifies the URI location of the XML file. - If applicable, set the locale value by invoking the
HTMLRenderSpec
object’ssetLocale
method and passing a string value that specifies the locale value. The default value is English.
NOTE
The Quick Starts that are associated with this section sets this value tofr_FR
. - Create an
-
Render an HTML form
Invoke the
FormsServiceClient
object’srenderHTMLForm
method and pass the following values:- A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
. - 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, specifyTransformTo.MSDHTML
. - A
com.adobe.idp.Document
object that contains data to merge with the form. If you do not want to merge data, pass an emptycom.adobe.idp.Document
object. - The
HTMLRenderSpec
object that stores HTML run-time options. - A string value that specifies the
HTTP_USER_AGENT
header value, such asMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
. - A
URLSpec
object that stores URI values that are required to render an HTML form. - A
java.util.HashMap
object that stores file attachments. This is an optional parameter, and you can specifynull
if you do not want to attach files to the form.
The
renderHTMLForm
method returns aFormsResult
object that contains a form data stream that must be written to the client web browser. - A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
-
Write the form data stream to the client web browser
- Create a
com.adobe.idp.Document
object by invoking theFormsResult
object ‘sgetOutputContent
method. - Get the content type of the
com.adobe.idp.Document
object by invoking itsgetContentType
method. - Set the
javax.servlet.http.HttpServletResponse
object’s content type by invoking itssetContentType
method and passing the content type of thecom.adobe.idp.Document
object. - Create a
javax.servlet.ServletOutputStream
object that is used to write the form data stream to the client web browser by invoking thejavax.servlet.http.HttpServletResponse
object’sgetOutputStream
method. - Create a
java.io.InputStream
object by invoking thecom.adobe.idp.Document
object’sgetInputStream
method. - Create a byte array and populate it with the form data stream by invoking the
InputStream
object’sread
method and passing the byte array as an argument. - Invoke the
javax.servlet.ServletOutputStream
object’swrite
method to send the form data stream to the client web browser. Pass the byte array to thewrite
method.
- Create a
Rendering an HTML Form with a custom toolbar using the web service API
Render an HTML form that contains a custom toolbar by using the Forms Service API (web service):
-
Include project files
- Create Java proxy classes that consume the Forms service WSDL.
- Include the Java proxy classes in your class path.
-
Create a Forms Java API object
Create a
FormsService
object and set authentication values. -
Reference a custom fscmenu XML file
- Create an
HTMLRenderSpec
object by using its constructor. - To render an HTML form with a toolbar, invoke the
HTMLRenderSpec
object’ssetHTMLToolbar
method and pass anHTMLToolbar
enum value. For example, to display a vertical HTML toolbar, passHTMLToolbar.Vertical
. - Specify the location of the fscmenu XML file by invoking the
HTMLRenderSpec
object’ssetToolbarURI
method and passing a string value that specifies the URI location of the XML file. - If applicable, set the locale value by invoking the
HTMLRenderSpec
object’ssetLocale
method and passing a string value that specifies the locale value. The default value is English.
NOTE
The Quick Starts that are associated with this section sets this value tofr_FR
. - Create an
-
Render an HTML form
Invoke the
FormsService
object’srenderHTMLForm
method and pass the following values:- A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
. - 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, specifyTransformTo.MSDHTML
. - A
BLOB
object that contains data to merge with the form. If you do not want to merge data, passnull
. - The
HTMLRenderSpec
object that stores HTML run-time options. - A string value that specifies the
HTTP_USER_AGENT
header value, such asMozilla/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 that are required to render an HTML form. - A
java.util.HashMap
object that stores file attachments. This parameter is optional, and you can specifynull
if you do not intend to attach files to the form. - An empty
com.adobe.idp.services.holders.BLOBHolder
object that is populated by therenderHTMLForm
method. This parameter value stores the rendered form. - An empty
com.adobe.idp.services.holders.BLOBHolder
object that is populated by therenderHTMLForm
method. This parameter stores the output XML data. - An empty
javax.xml.rpc.holders.LongHolder
object that is populated by therenderHTMLForm
method. This argument stores the number of pages in the form. - An empty
javax.xml.rpc.holders.StringHolder
object that is populated by therenderHTMLForm
method. This argument stores the locale value. - An empty
javax.xml.rpc.holders.StringHolder
object that is populated by therenderHTMLForm
method. This argument stores 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 thecom.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. - A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
-
Write the form data stream to the client web browser
- Create a
FormResult
object by getting the value of thecom.adobe.idp.services.holders.FormsResultHolder
object’svalue
data member. - Create a
BLOB
object that contains form data by invoking theFormsResult
object’sgetOutputContent
method. - Get the content type of the
BLOB
object by invoking itsgetContentType
method. - Set the
javax.servlet.http.HttpServletResponse
object’s content type by invoking itssetContentType
method and passing the content type of theBLOB
object. - Create a
javax.servlet.ServletOutputStream
object that is used to write the form data stream to the client web browser by invoking thejavax.servlet.http.HttpServletResponse
object’sgetOutputStream
method. - Create a byte array and populate it by invoking the
BLOB
object’sgetBinaryData
method. This task assigns the content of theFormsResult
object to the byte array. - Invoke the
javax.servlet.http.HttpServletResponse
object’swrite
method to send the form data stream to the client web browser. Pass the byte array to thewrite
method.
- Create a
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterRapid Feature Releases with AEM Cloud: Telegraph Media Group’s RDE Strategy
Hear how Telegraph Media Group, the award-winning publisher of The Daily Telegraph, The Sunday Telegraph, The Telegraph Magazine,...
Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)
Driving Marketing Agility and Scale: Transforming your Content Supply Chain with AI
Marketers everywhere are feeling the pressure to deliver impactful campaigns faster and at greater scale. This Strategy Keynote explores...
Tue, Mar 18, 2:30 PM PDT (9:30 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more