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.

package itso.cics.eci.j2ee.testercci;<br />

import java.io.Serializable;<br />

/**<br />

* Data Bean which stores a results string and a byte array representing the<br />

data which created the string.<br />

* Initially has an empty string and zero length byte array.<br />

*/<br />

public class ResultsBean implements Serializable<br />

{<br />

private String resultsString = "";<br />

private byte[] resultsBytes = new byte[0];<br />

}<br />

public void setResultsString(String data)<br />

{<br />

resultsString = data;<br />

}<br />

public String getResultsString()<br />

{<br />

return resultsString;<br />

}<br />

public void setResultsBytes(byte[] data)<br />

{<br />

resultsBytes = data;<br />

}<br />

public byte[] getResultsBytes()<br />

{<br />

return resultsBytes;<br />

}<br />

Figure B-27 ResultsBean class<br />

<strong>The</strong> next section of code handles any exceptions that occur in the execute()<br />

method and is shown in Figure B-28 on page 366. To deal with an exception, we<br />

build a message consisting of a timestamp of when it was caught, and the String<br />

representation of the exception that occurred. We then set a request attribute<br />

containing this String and specify we want to forward to the JSP that displays<br />

exceptions (exception.jsp).<br />

Appendix B. Sample applications 365

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

Saved successfully!

Ooh no, something went wrong!