01.01.2013 Views

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

public class CTGTesterCCIServlet extends HttpServlet<br />

{<br />

// date loaded into application server<br />

private Date loadedDate;<br />

// jsp names<br />

private static final String jspResults = "results.jsp";<br />

private static final String jspError = "error.jsp";<br />

// names of attributes set in the request<br />

private static final String attrResultsString = "results";<br />

private static final String attrDefaultResultsString = "defaultResults";<br />

private static final String attrHexResultsString = "hexResults";<br />

private static final String attrErrorException = "errorException";<br />

private static final String attrErrorMessages = "errorMessages";<br />

private static final String attrLastLoaded = "lastLoaded";<br />

private static final String attrCicsProgram = "funcName";<br />

private static final String attr<strong>Gateway</strong>URL = "gatewayURL";<br />

private static final String attr<strong>Gateway</strong>Port = "gatewayPort";<br />

private static final String attrServer = "server";<br />

private static final String attrUsername = "username";<br />

private static final String attrHttpUsername = "httpusername";<br />

private static final String attrMirror = "mirror";<br />

private static final String attrCommareaLength = "commareaLength";<br />

private static final String attrCommarea = "commareaInput";<br />

private static final String attrManaged = "managed";<br />

private static final String attrEncoding = "encoding";<br />

private static final String attrTrace = "trace";<br />

private static final String attrIterations = "iterations";<br />

private static final String attrAppTrace = "appTrace";<br />

Figure B-21 Class variables<br />

We declare the names of the JSPs we use to display the results of the program,<br />

as well as the attribute names we use to pass the results to the JSPs.<br />

<strong>The</strong> Servlet interface class contains the init(), destroy(), and service()<br />

methods. <strong>The</strong> first of these methods we define is our init() method<br />

(Figure B-22 on page 360). <strong>The</strong> purpose of the init() method is to perform the<br />

necessary servlet initialization. It is guaranteed to be the first method to be called<br />

on any servlet instance. <strong>The</strong> servlet implemented may choose to override this<br />

method to perform custom servlet initialization. In our init() method, we<br />

instantiate our loadedDate object so as to set the time of loading and also call the<br />

superclass init() method to ensure the proper HttpServlet initialization occurs.<br />

Appendix B. Sample applications 359

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!