Community articleSample JSP Application
Added by IBM contributorIBM on November 25, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.

The API includes a sample web application demonstrating how to use JSP pages to extend the functionality of XFDL forms. This simple application consists of three files, located in the folder <API Program Folder>\samples\java\jsp\demo. The following table describes the functions of each file:
jspget.jspThis JSP page is an example of a standard HTTP GET operation. The first JSP scriptlet obtains the current date and calculates the number of days until Christmas. The XFDL form specifies two labels to display this information. The second scriptlet creates the URL that the form's submit button uses to call jsppostt2.jsp. Within the XFDL portion of the page, a JSP include directive obtains a label item from getlabel.txt.
getlabel.txtAlthough this file does not contain a complete form, it does contain XFDL code defining a label item. jspget.jsp accesses this code using an include directive.
jsppost.jspThis page is an example of a standard HTTP POST operation. The scriptlet uses the API's streaming method readForm to obtain the number of days until Christmas and the signature from jspget.jsp. It then uses getSignatureVerificationStatus to validate the signature. Finally, the XFDL portion of the page specifies two labels to display the results to the end user.

To run this sample in WebSphere® Application Server, you must first package the above files into a WAR file. You can then deploy the WAR file using the WebSphere Application Server Administrator Console. For other application servers, you can package the files as WARs or place the JSP files into your web server JSP folder. Refer to the documentation of your application server for more information.
To run the application, users either follow a link or type the URL into the address field of the browser. For example, if the application is running on WebSphere Application Server, the URL would be: http://<server_name>:<port><example_dir>/jsp/jspget.jsp.
Parent topic:
JSP Sample Application