Providing initial values for fields of a Faces JSP page

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: 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:

  1. In the J2EE perspective of the Project Explorer view, expand Dynamic Web Projects > PhoneBookWeb > Java Resources > JavaSource > pagecode > PBookF.java.
  2. In the PhoneBookWeb project, right-click PBookF.java and select Open With > Java Editor.
  3. 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;	
    }
  4. 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.
Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.