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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure B-4 Class variables<br />

342 <strong>CICS</strong> <strong>Transaction</strong> <strong>Gateway</strong> <strong>V5</strong><br />

public class CTGTesterECIServlet 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 />

private static final String jspException = "exception.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 attrErrorMessages = "errorMessages";<br />

private static final String attrErrorException = "errorException";<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 attrReturnCode = "returnCode";<br />

private static final String attrReturnString = "returnString";<br />

private static final String attrAbendCode = "abendCode";<br />

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

private static final String attrProgress = "progress";<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 (Figure B-5<br />

on page 343). <strong>The</strong> purpose of the init() method is to perform the necessary<br />

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

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

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

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

init() method to ensure the proper HttpServlet initialization occurs.

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

Saved successfully!

Ooh no, something went wrong!