起步软件技术论坛-X3

 找回密码
 立即注册
搜索
12
返回列表 发新帖
楼主: huixiangtao

【结贴】当前浏览器进程已经运行x3客户端,同一进程不能多次运行X3客户端**

[复制链接]
 楼主| 发表于 2009-6-3 12:44:22 | 显示全部楼层
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.justep.loader.LibContext"%>
<%@ page import="java.lang.reflect.Method" %>
<%
Class pclass = LibContext.getInstance().getLoader().loadClass("com.justep.web.SysServerProvider");
Object pobj = pclass.newInstance();
Method getBXClassIDMethod = pclass.getMethod("getBXClassID",new Class[]{});
Method getBXCodeMethod = pclass.getMethod("getBXCodebase",new Class[]{});
Method getSysServerURLMethod = pclass.getMethod("getSysServerURL",new Class[]{});
Method getClientPathMethod = pclass.getMethod("getClientPath",new Class[]{});
Method getVersionMethod = pclass.getMethod("getVersion",new Class[]{});
Method getVersionKeyMethod = pclass.getMethod("getVersionKey",new Class[]{});
Method getVersionHashMethod = pclass.getMethod("getVersionHash",new Class[]{});

String classId = (String)getBXClassIDMethod.invoke(pobj,new Object[]{});
String codeBase = (String)getBXCodeMethod.invoke(pobj,new Object[]{});
String url = (String)getSysServerURLMethod.invoke(pobj,new Object[]{});
String clientPath = (String)getClientPathMethod.invoke(pobj,new Object[]{});
String version = (String)getVersionMethod.invoke(pobj,new Object[]{});
String versionKey = (String)getVersionKeyMethod.invoke(pobj,new Object[]{});
String versionHash = (String)getVersionHashMethod.invoke(pobj,new Object[]{});
String params = " -s" + url;
if (clientPath != null && !"".equals(clientPath))
  params = params + " -p" + clientPath;

if (version != null && !"".equals(version))
  params = params + " -vid" + version;

if (versionKey != null && !"".equals(versionKey))
  params = params + " -vk" + versionKey;

if (versionHash != null && !"".equals(versionHash))
  params = params + " -vh" + versionHash;
%>


<%//通过request获取登录帐号、密码
String username = request.getParameter("username");
String pwd = request.getParameter("pwd");
if(username.contains("\'")) {
        username = username.substring(username.indexOf("\'")+1,username.lastIndexOf("\'"));
}
if(username.contains("\"")) {
        username = username.substring(username.indexOf("\"")+1,username.lastIndexOf("\""));
}
if(pwd.contains("\'")) {
        pwd = pwd.substring(pwd.indexOf("\'")+1,pwd.lastIndexOf("\'"));
}
if(pwd.contains("\"")) {
        pwd = pwd.substring(pwd.indexOf("\"")+1,pwd.lastIndexOf("\""));
}


%>

<HTML>
<HEAD>
<title>X3 协同管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script src="Scripts/AC_ActiveX.js" type="text/javascript"></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</HEAD>

<BODY leftmargin="0" topmargin="0" scroll="no">

<script type="text/javascript">
  AC_AX_RunContent("id", "X3X", "classid", "<%= classId%>", "codebase", "<%= codeBase%>", "width", "100%", "height", "100%", "align", "center", "hspace", "0", "vspace", "0");
</script>
<noscript><OBJECT  id = "X3X"
          classid="<%= classId%>"
          codebase="<%= codeBase%>"
          width="100%"
          height="100%"
          align=center
          hspace=0
          vspace=0
>
</OBJECT></noscript>

<script type="text/javascript">
  AC_AX_RunContent("id", "WebBrowser", "width", "0", "height", "0", "classid", "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2");
</script>
<noscript><object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object></noscript>

<script ID="BusinessCloseEventHandler" language="javascript" FOR="X3X" EVENT="OnTerminate">
  top.window.opener=null;
  top.window.close();
  //WebBrowser.ExecWB(45,1); // close window
</script>
<script ID="RTEventHandler" language="javascript" FOR="X3X" EVENT="OnRTEvent(Param)">
  //X3脚本事件
  //可以在脚本中执行RTEvent.Execute('Param1');最终调用会执行到这里,Param1的内容格式可以自定义
  //Param变量的内容就是传出的字符串(Param1)。
</script>

<script type="text/javascript">
  function BeforeClose()
  {
    if(!X3X.TerminateQuery())
    {
      event.returnValue = "";
    }
  }

  document.title = X3X.DisplayName;
  X3X.Params = "<%= params%>";
  X3X.UpdateVersion();
// X3X.ShowSplash();
  X3X.Init();
// X3X.CloseSplash();
// X3X.Run("", "", "", "");
// X3X.Logon("<%=username%>","<%=pwd%>");
     X3X.Run2("Biz:\\FWT\\FUNC\\FWCX.Func", "<%=username%>;<%=pwd%>");
  document.body.onbeforeunload=BeforeClose;
  document.title = X3X.DisplayName;
</script>

</BODY>
</HTML>
回复 支持 反对

使用道具 举报

发表于 2009-6-3 15:01:59 | 显示全部楼层
电话沟通过,现在点击元素运行起来的ie在进程中看不到。找找原因为什么看不到这个进程?如果每次运行起来的ie都是一个单独的进程那么每个ie都可以运行一个平台。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-4 14:28:23 | 显示全部楼层
我做了一个简单的例子test.html,这个html文档里面放了四个<a>元素。
第一个链接百度新闻,第二个链接百度mp3,第三个连接新浪,……,
经查看windows任务管理器的进程发现,单从test.html点开一个网页链接,并不会创建一个新的IEXPLORE.EXE进程,这个网页应该算是前一进程的子进程。这应该算是html文档的规则吧。
但直接IE打开的网页,都会在进程中新创建一个IEXPLORE.EXE进程。
所以X3这儿,能不能做做什么修改,让一个线程就打开一个X3客户端,这样可以让一个进程运行多个线程,也就运行了多个X3客户端。
不知道能不能实现?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-8 21:16:08 | 显示全部楼层
我按照
http://bbs.justep.com/showthread ... d=157556#post157556
这个帖子上所说的,更改了login.html
并作了一个试验:
test.HTML源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<a href="http://59.64.157.184:8081/x3/loginFWCX1.html" target="_blank">服务查询</a><br>
<a href="http://59.64.157.184:8081/x3/loginWBCX1.html" target="_blank">外部查询</a><br>
<a href="http://59.64.157.184:8081/x3/loginSJCX1.html" target="_blank">事件查询</a><br>
<a href="http://59.64.157.184:8081/x3/loginWTCX1.html" target="_blank">问题查询</a>

</body>
</html>
最后的效果是:点第一个a元素的时候,网页正常打开,
但是点第二个a元素的时候,新打开的网页一闪而过,消失了。
这时如果我把之前第一个a元素打开那个网页关闭,再点其他的a元素,其他的a元素链接的网页还是打不开,效果也是一闪而过。

最终效果不应该这样吧?
回复 支持 反对

使用道具 举报

发表于 2009-6-9 08:49:11 | 显示全部楼层
你没改business.jsp.没删除cookie,当然就再也打不开了。
我的例子是对打开整个平台而做的。
例子目的是不让客户同时打开多个平台。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-9 09:02:26 | 显示全部楼层
哦,是我没有说清楚,我修改了login.html和Business.jsp,
loginFWCX1.html的源码如下:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<script language="javascript" src="mycookie.js"/></script>
<BODY topmargin="0">
正在连接到Justep X3 Web Server...
<script language="JavaScript" type="text/JavaScript">
//***********************     
  if (get_cookie('opened')!=''){     
      window.top.close();
  } else{      
  document.cookie="opened=yes";//加上cookie
  window.location.href="BusinessFWCX1.jsp?username=chenping&pwd=";
    }   
//***********************  
</script>

</BODY>
</HTML>
BusinessFWCX1.jsp的源码如下所示:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.justep.loader.LibContext"%>
<%@ page import="java.lang.reflect.Method" %>
<%
Class pclass = LibContext.getInstance().getLoader().loadClass("com.justep.web.SysServerProvider");
Object pobj = pclass.newInstance();
Method getBXClassIDMethod = pclass.getMethod("getBXClassID",new Class[]{});
Method getBXCodeMethod = pclass.getMethod("getBXCodebase",new Class[]{});
Method getSysServerURLMethod = pclass.getMethod("getSysServerURL",new Class[]{});
Method getClientPathMethod = pclass.getMethod("getClientPath",new Class[]{});
Method getVersionMethod = pclass.getMethod("getVersion",new Class[]{});
Method getVersionKeyMethod = pclass.getMethod("getVersionKey",new Class[]{});
Method getVersionHashMethod = pclass.getMethod("getVersionHash",new Class[]{});

String classId = (String)getBXClassIDMethod.invoke(pobj,new Object[]{});
String codeBase = (String)getBXCodeMethod.invoke(pobj,new Object[]{});
String url = (String)getSysServerURLMethod.invoke(pobj,new Object[]{});
String clientPath = (String)getClientPathMethod.invoke(pobj,new Object[]{});
String version = (String)getVersionMethod.invoke(pobj,new Object[]{});
String versionKey = (String)getVersionKeyMethod.invoke(pobj,new Object[]{});
String versionHash = (String)getVersionHashMethod.invoke(pobj,new Object[]{});
String params = " -s" + url;
if (clientPath != null && !"".equals(clientPath))
  params = params + " -p" + clientPath;

if (version != null && !"".equals(version))
  params = params + " -vid" + version;

if (versionKey != null && !"".equals(versionKey))
  params = params + " -vk" + versionKey;

if (versionHash != null && !"".equals(versionHash))
  params = params + " -vh" + versionHash;
%>


<%//通过request获取登录帐号、密码
String username = request.getParameter("username");
String pwd = request.getParameter("pwd");
if(username.contains("\'")) {
        username = username.substring(username.indexOf("\'")+1,username.lastIndexOf("\'"));
}
if(username.contains("\"")) {
        username = username.substring(username.indexOf("\"")+1,username.lastIndexOf("\""));
}
if(pwd.contains("\'")) {
        pwd = pwd.substring(pwd.indexOf("\'")+1,pwd.lastIndexOf("\'"));
}
if(pwd.contains("\"")) {
        pwd = pwd.substring(pwd.indexOf("\"")+1,pwd.lastIndexOf("\""));
}


%>

<HTML>
<HEAD>
<title>X3 协同管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script src="Scripts/AC_ActiveX.js" type="text/javascript"></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</HEAD>

<BODY leftmargin="0" topmargin="0" scroll="no">

<script type="text/javascript">
  AC_AX_RunContent("id", "X3X", "classid", "<%= classId%>", "codebase", "<%= codeBase%>", "width", "100%", "height", "100%", "align", "center", "hspace", "0", "vspace", "0");
</script>
<noscript><OBJECT  id = "X3X"
          classid="<%= classId%>"
          codebase="<%= codeBase%>"
          width="100%"
          height="100%"
          align=center
          hspace=0
          vspace=0
>
</OBJECT></noscript>

<script type="text/javascript">
  AC_AX_RunContent("id", "WebBrowser", "width", "0", "height", "0", "classid", "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2");
</script>
<noscript><object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object></noscript>

<script ID="BusinessCloseEventHandler" language="javascript" FOR="X3X" EVENT="OnTerminate">
  top.window.opener=null;
  top.window.close();
  //WebBrowser.ExecWB(45,1); // close window
</script>
<script ID="RTEventHandler" language="javascript" FOR="X3X" EVENT="OnRTEvent(Param)">
  //X3脚本事件
  //可以在脚本中执行RTEvent.Execute('Param1');最终调用会执行到这里,Param1的内容格式可以自定义
  //Param变量的内容就是传出的字符串(Param1)。
</script>

<script language="javascript" src="mycookie.js"/></script>
<script type="text/javascript">

  function BeforeClose()
  {   
    if(!X3X.TerminateQuery())
    {
    delCookie('opened');//****************************
      event.returnValue = "";
    }
  }


  document.title = X3X.DisplayName;
  X3X.Params = "<%= params%>";
  X3X.UpdateVersion();
// X3X.ShowSplash();
  X3X.Init();
// X3X.CloseSplash();
// X3X.Run("", "", "", "");
  X3X.Logon("<%=username%>","<%=pwd%>");  //自动登录
  X3X.Run("Biz:\\System\\Init.Func", "Biz:\\FWT\\FUNC\\FWCX.Func", "", "");  //必须要传入参数系统初始化功能
  document.body.onbeforeunload=BeforeClose;
  document.title = X3X.DisplayName;
</script>

</BODY>
</HTML>
现在这种状态,还是14楼上所描述的效果那样,
是我的代码有问题,还是效果就应该如此呢?
回复 支持 反对

使用道具 举报

发表于 2009-6-9 09:06:06 | 显示全部楼层
你只要加点alert,看看代码触发的过程。
上面已经把思路写了,你可以自己调试看看。
回复 支持 反对

使用道具 举报

发表于 2009-6-9 10:55:43 | 显示全部楼层
询问了开发人员,我们这个限制就是为了防止出一些异常,其实本来就是能打开多个的,只是强制做了限制。
楼主考虑下修改下需求吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-9 16:02:56 | 显示全部楼层
修改需求,我得向上请示。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-22 13:46:14 | 显示全部楼层
谢谢,先结贴吧!
客户如果不满意,这块可能还得动。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-19 14:28 , Processed in 0.057191 second(s), 14 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表