IBM Support

How to automatically close the response page from an XFDL submission.

Troubleshooting


Problem

This Technote describes how to manage the HTML response page that is generated by the submission.

Resolving The Problem

The HTML response page that is provided after a submission is a generic response that is provided by the product to give a status back to the user in regards to the success or failure of a submission.

There are a few options to handle this submission status page that comes back from the server.

Below I have illustrated 3 different options to mange the response page (amongst many other options):

In each of the scenarios below I wrote out the string to the response objects PrintWriter so that it will be sent as a response to the users browser. This code is placed in the servlet or portlet that the submission went to (DoPost, ProcessAction).

You will also want to ensure you set the response.contentType("text/html") so that the response will be interpreted correctly and opened with the correct programe, in our case a browser.

1) The resulting HTML page provides a hyperlink that needs to be clicked to close the browser window.

response.getWriter().println("" +

"<HTML><HEAD><script language=\"javascript\" type=\"text/javascript\">" +
"function closeWindow() {" +
"window.open('','_parent','');" +
"window.close();" +
"}" +
"</script></HEAD>" +
"<BODY><a href=\"javascript:closeWindow();\">Close Window</a></BODY></HTML>");

2) Browser window automatically closes when loaded. This does cause the clients screen to quickly flash as the webpage is first opened then quickly closed.

response.getWriter().println("" +

"<HTML><HEAD><script language=\"javascript\" type=\"text/javascript\">" +
"function closeWindow() {" +
"window.open('','_parent','');" +
"window.close();" +
"}" +
"</script></HEAD>" +
"<BODY onload=\"javascript:closeWindow();\"></BODY></HTML>");

3) The browser window displays a message to the user then automatically closes after 1 sec.

response.getWriter().println("" +

"<HTML><HEAD><script language=\"javascript\" type=\"text/javascript\">" +
"function closeWindow() {" +
"window.open('','_parent','');" +
"window.close();" +
"}" +
"function delay() {\n" +
"setTimeout(\"closeWindow()\", 1000);\n" +
"}\n" +
"</script></HEAD>" +
"<BODY onload=\"javascript:delay();\"></BODY></HTML>");

Each solution above provides a different user experience.

In each case the application can have different behaviours based on the result of the submission.

If the submission fails for any reason, an error message can be displayed to the user with a close button or hyperlink and if the submission is successful, you can automatically close the submission results page.

[{"Product":{"code":"SS4BP3","label":"Lotus Forms Server"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Webform server","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0.1;8.0.0.2;8.0.0.1;8.0;4.0.0.2;4.0.0.1;4.0;3.5.1.2;3.5.1.1;3.5.1;3.5;3.0.1;3.0","Edition":"","Line of Business":{"code":"LOB31","label":"WCE Watson Marketing and Commerce"}}]

Document Information

Modified date:
16 June 2018

UID

swg21501450