日期:2014-05-18  浏览次数:20716 次

在jsp中调用自己写的ocx为什么每次都提示安装?
每次运行调用ocx的jsp页时都会提示安装,为什么?
JSP页代码如下
<%@   page   contentType= "text/html;charset=GB2312 "   language= "java "   %>
<%@   page   import   = "java.io.IOException,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpSession,javax.servlet.jsp.*; "%>
<html>
<head>
    <title> OCX测试 </title>
</head>

<body   Leftmargin=0   topmargin=0     rightmargin= "0 "   bottommargin= "0 ">
<table   width= "100% "   height= "100% ">
  <tr   height= "100% "> <td   valign= "top ">
<%
//System.gc();
StringBuffer   outString   =   new   StringBuffer( " ");
outString.append( " <OBJECT   id   =   \ "test\ "   \n ");
outString.append( "classid=\ "clsid:BB3A37B1-A516-4BBA-9F97-91DED12CAF30\ "   \n ");
outString.append( "codebase=\ "./test.cab#version=1,0\ "   \n ");
outString.append( "width=100%   height=100%   align=center   hspace=0   vspace=0>   \n ");
outString.append( " </OBJECT>   \n ");
JspWriter   writer   =   pageContext.getOut();
    try
        {
            writer.print(outString.toString());
        }
    catch(IOException   e)
        {
            throw   new   JspException(e.getMessage());
        }
%>
  </td>
  </tr>
</table>
</body>
</html>


------解决方案--------------------
为什么不作为静态html元素 <object> </object> 直接写,而用java?
------解决方案--------------------
在ie中把这个站点加入信任站点