Community articleCombining JSP and XFDL
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Creating a JSP page involves integrating JSP elements with the source code of the original HTML or XML web document. In the case of XFDL forms, this means adding appropriate JSP elements to the form's XFDL code using a text editor. Once complete, the resulting document is a JSP page and should have a .jsp extension.
Note: Once you add JSP code to an XFDL form, you will no longer be able to open the file with IBM® Forms Designer.
While the specific content of each JSP page depends on the logic of the application and the design of the form, certain fixed elements must be present in every JSP page that contains XFDL. The following elements must appear exactly as shown in every JSP that includes XFDL:
<?xml version="1.0"?> This line is the standard XML file identifier. It must appear as the first line in the JSP page. There can be no blank lines or spaces ahead of this text.
<% response.setContentType("application/x-xfdl"); %> This line sets the mime type of the http response object. In this case, it identifies the object as an XFDL document. As a result, the user's browser will display the document using the Viewer. With the exception of any optional comments or whitespace, this line should appear immediately after the XML file identifier.

Once you have included these standard elements, you can add the rest of your custom JSP code such as directives, declarations, or scriptlets.
Note: The XFDL portion of the JSP page must not be compressed but it is valid to use the XFDL <transmitformat> option to specify either ascii or binary compression for the transmission of the page.
Parent topic:
JSP Sample Application