<%-- Begin Doug --%> <%@ page import = "com.nativeminds.client.XmlClient" %> <% /*************************************************************************** * Copyright (c) NativeMinds, Inc. 1998-2002. All Rights Reserved. * **************************************************************************** * NativeMinds, Inc. * * 480 2nd Street, Suite 200 * * San Francisco, CA 94107 * * (415) 777-3111 * **************************************************************************** * * File : Conversation.jsp * Date : 5/21/2001 * Author : Pat Blair * Revision : 11/14/2002, Douglas Held * Notes : For use with the NativeMinds Java-XML Exchanger * **************************************************************************** * This document contains proprietary and confidential information. No * * part of this document or the computer program it embodies may be in * * any way copied, duplicated, reproduced, translated into a different * * programming language, or distributed to any person, company, or * * corporation without the prior written consent of NativeMinds, Inc. * ***************************************************************************/ %> <% // Initialization String strvRepName = new String("Pepsi"); String strServer1 = new String("nm1:8080"); String strServer2 = new String("nm2:8080"); // Strings going into NeuroServer String strDefaultServer = new String(""); String strBackupServer = new String(""); String strWhatUserSaid = new String(""); Cookie existingCookie[] = request.getCookies(); // Strings coming out of NeuroServer String strRelatedItems = new String(""); String strFaceImage = new String(""); String strURL = new String(""); String strTarget = new String(""); // fix up WhatUserSaid if ( request.getParameter("WhatUserSaid") != null ) { strWhatUserSaid = request.getParameter("WhatUserSaid"); } // Before connecting, send in memory attributes as necessary, e.g. // objNeuroServer.setMemory("myAttribute", strServer2); // check to see if the vRep is connected if (!objNeuroServer.isConnected()) { // Load Balancer // Select the Default and Backup servers for this session if ( Math.random() > 0.5 ) { strDefaultServer = strServer1; strBackupServer = strServer2; } else { strDefaultServer = strServer2; strBackupServer = strServer1; } // set the primary server (and port) objNeuroServer.setVrepHost(strDefaultServer); // set the additional server(s) objNeuroServer.addOtherHost(strBackupServer); // set the name of the robot objNeuroServer.setVrepName(strvRepName); if (existingCookie == null || existingCookie.length == 0) { // no cookie is present // run the zero-argument connect() method objNeuroServer.connect(); // Set new cookie for ReturningUserKey provided by NeuroServer Cookie newCookie = new Cookie ("ReturningUserKey", objNeuroServer.getReturningUserKey()); newCookie.setMaxAge(365 * 24 * 60 * 10); response.addCookie(newCookie); } else // Cookie already exists { objNeuroServer.connect(existingCookie[0].getValue()); } } else // the vRep is already connected { // send back the user's last input objNeuroServer.talk(strWhatUserSaid); } // After the vRep connection, read memory attributes as appropriate strRelatedItems = objNeuroServer.memory("RelatedItems"); if ( strRelatedItems == null ) strRelatedItems = ""; // Retrieve the face image from NeuroServer strFaceImage = objNeuroServer.memory("FaceToShow"); if ( strFaceImage.equals("") ) { strFaceImage = "happy.gif"; } // Retrieve the URL to show with JavaScript strURL = objNeuroServer.memory("DisplayURL"); if ( strURL.equals("#ERROR#") ) { strURL = ""; } // Retrieve the Target window for the strURL strTarget = objNeuroServer.memory("DisplayTarget"); ////////////////////////////// // HTML Section %> <%-- End Doug --%> Help - Ask Lisa <%-- Begin Doug --%> <%-- End Doug --%>
"vRepForm" method=<%-- by Doug --%>"GET" action="">
Pepsi Banner
Lisa is the Pepsi Virtual representative. If you have questions about Pepsi, our products, the website or anything Pepsi related, just ask lisa and she'll be glad to help.

%= objNeuroServer.getWhatVrepSaid() %

%= objNeuroServer.memory("RelatedItems") %

Help Close