Establishing a session transaction for HTML channel

After the toolkit application is initialized, the HTML client can connect to the server and establish a session using the CSEstablishSessionServlet class.
  1. Define the HTML channel parameter in btt.xml:
    <kColl id="html">
      <field id="requestHandler" value="com.ibm.btt.cs.html.HtmlRequestHandler" />
      <field id="presentationHandler" 	value="com.ibm.btt.cs.html.HtmlPresentationHandler" />
      <field id="cookies" value="true" />
      <field id="runInSession" value="true" />
      <field id="defaultProcessesTimeout" value="300000" />
    </kColl>
    
    <kColl id="HTMLClient">
      <field id="minRequestResubmitTime" value="0" />
      <field id="filePath" value="/btt/html/" />
      <field id="errorPage" value="errorpage.jsp" />
      <field id="homePage" value="signin.jsp" />
      <field id="startUpOp" value="startUpHtmlSessionOp" />
    </kColl>
    Note: You can find the XML files in the <toolkit_root>/samples/BTTMultiChannleSample/SampleBusiness/ directory.
  2. Define the HTML client startup operation in the startUpHtmlSessionOp.xml:
    <startUpHtmlSessionOp.xml>
      <operation context="startupHtmlCtx" id="startUpHtmlSessionOp"
        implClass="com.ibm.btt.sample.operation.StartHtmlSession"/> 
    </startUpHtmlSessionOp.xml>
  3. Define the HTML client startup related context in dsectxt.xml:
    <context id="branchServer" type="branch" parent="nil">
      <refKColl refId="branchData" />
    </context>
    
    <context id="sessionCtx" parent="branchServer" type="session">
      <refKColl refId="sessionData" />
    </context>
    
    <context id="startupHtmlCtx" type="op" parent="branchServer">
      <refKColl refId="startupHtmlData" />
    </context>
    Note: the branchServer context and the sessionCtx context are used by all the channels. You only need to define them once.
  4. Define the HTML client startup data element in dsedata.xml:
    <!--relavant data element defination of branchServer context-->
    <kColl id="branchData" dynamic="true">
      <refData refId="BranchId" />
      <iColl id="languages" size="2">
        <kColl id="language">
          <field id="name" />
          <field id="locale" />
        </kColl>
      </iColl>
    </kColl>
    
    <!--relavant data element defination of sessionCtx context-->
    <kColl id="sessionData">
      <refData refId="TID" />
      <refData refId="userId" />
      <refData refId="CustomerId" />
      <refData refId="CustomerName" />
      <refData refId="HostBuff" />
      <refData refId="sessionID" />
      <refData refId="dse_locale" />
      <refData refId="dse_errorMessages" />
      <refData refId="accounts" />
      <refData refId="forwardName" />
    
      <refData id="telephone" />
      <refData id="address" />
      <refData id="email" />
    
      <field id="currentStyle" />
      <field id="currentLocale" />
      <field id="currentDate" />
    </kColl>
    
    <!--relavant data element defination of startupHtmlCtx context-->
    <kColl id="startupHtmlData" />
  5. Implement the HTML client startup operation in <toolkit_root>/samples/BTTMultiChannleSample/SampleBusiness/com.ibm.btt.sample.operation.StartHtmlSession.java.
    public class StartHtmlSession extends BTTServerOperation {
        ...
        
        public void execute() throws Exception {
            Context root = ContextFactory.getRoot();
            if (root == null) {
                root = ContextFactory.createContext("branchServer", false);
            }
            Context sessionCtx = ContextFactory.createContext("sessionCtx", true);	
            sessionCtx.chainTo(root);
            this.getContext().chainTo(sessionCtx);
        }
    }