It is recommended that you provide initial values for the fields
of a Faces JSP page that is generated by Rational Application Developer. To
provide initial values, you must modify one of the methods of the generated
Faces JSP. The method that returns the parameter bean which is used by the
method that runs the IMS transaction must be updated.
It is recommended that you provide initial values for fields of a
Faces JSP page because of the following reasons:
- The LL field of an IMS transaction input message must accurately reflect
the size of the message buffer sent to IMS. Rather than leave the calcuation
of this value to the user of the JSP page, you should initialize the field
to the correct value using the getSize() method provided by the data binding
for the transaction input message.
- The ZZ field of an IMS transaction input message does not affect the user
of the JSP page and should be initialized to zero.
- The field for the transaction code of the input message should be initialized
with the correct value. Generally, the user are not provided the transaction
code for the IMS transaction that your application is running.
- Other fields may need to be initialized to remove blanks, making the Faces
JSP easier to use.
In addition to initializing fields such as LL, ZZ, and the field for
transaction code, you should hide these fields in the Faces JSP page because
they do not affect the user. This topic does not discuss how to hide the fields
of a JSP page.
To provide initial values for the field of a JSP page, you
must modify a method of the generated Faces JSP. To modify the method of the
generated Faces JSP, complete the following steps:
- In the J2EE perspective of the Project Explorer view, expand Dynamic
Web Projects > PhoneBookWeb > Java Resources > JavaSource > pagecode > PBookF.java.
- In the PhoneBookWeb project, right-click PBookF.java and
select Open With > Java Editor.
- Update the method, getJavaRunPBParamBean(),
with the following code:
public JavaRunPBParamBean getJavaRunPBParamBean() {
if (javaRunPBParamBean == null) {
javaRunPBParamBean = new JavaRunPBParamBean();
// Initialize fields of input message.
INPUTMSG input = javaRunPBParamBean.getArg();
input.setIn__ll((short)input.getSize());
input.setIn__zz((short)0);
input.setIn__trcd("IVTNO");
input.setIn__cmd("DISPLAY");
input.setIn__name1("LAST1");
input.setIn__name2("");
input.setIn__extn("");
input.setIn__zip("");
// Initialize input fields for exposed input properties.
javaRunPBParamBean.setMyImsRequestType(1);
javaRunPBParamBean.setMyInteractionVerb(1);
javaRunPBParamBean.setMyCommitMode(1);
javaRunPBParamBean.setMyExecutionTimeout(0);
javaRunPBParamBean.setMySocketTimeout(0);
}
return javaRunPBParamBean;
}
- Save your changes and close the file.
The fields of INPUTMSG, which is the input message of the IMS transaction,
are now initialized, as well as some exposed input properties.