熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

如何在JSP上放置兼容Firefox、IE、Chrome的applet

2022-06-13   來源: JSP教程 

  pplet雖然已經基本上沒人用了但是它還有一些應用場景的為了兼容性為了各個浏覽器不能直接直接寫<applet>標簽最後考慮一下測試了幾天最後還是寫如下比較適合多個浏覽器兼容希望對大家有所幫助

  <%@page language="java" import="javautil*" pageEncoding="UTF" contentType="text/html; charset=utf"%> <% //該寫法兼容FirefoxIEChrome浏覽器 //applet加載類 String appletClass = "cncompanskyframecqapprinterCQAPPrinterAppletclass"; //依賴jar包 目錄 String appletCodebase="applets"; String appletJar = "commonsloggingjarcommonscollectionsjarjfreechartjarjcommonjar"; int width = height = ; //查詢參數 String queryString = requestgetQueryString(); if (queryString == null) { queryString = ""; } queryString = "/otp/cqap/cqapprinterservletjsp?" + queryString; %> <!DOCTYPE html PUBLIC "//WC//DTD XHTML Transitional//EN" " <html> <head> <meta httpequiv="XUACompatible" content="IE=EmulateIE" /> <meta httpequiv="ContentType" content="text/html; charset=utf" /> <title>打印</title> </head> <body> <! 環境判斷 > <!"CONVERTED_APPLET"> <! CONVERTER VERSION > <SCRIPT LANGUAGE="JavaScript"><! var _info = navigatoruserAgent; var _ns = false; var _ie = (_infoindexOf("MSIE") > && _infoindexOf("Win") > && _infoindexOf("Windows ") < ); //></SCRIPT> <COMMENT> <SCRIPT LANGUAGE="JavaScript"><! var _ns = (navigatorappNameindexOf("Netscape") >= && ((_infoindexOf("Win") > && _infoindexOf("Win") < && javalangSystemgetProperty("osversion")indexOf("") < ) || (_infoindexOf("Sun") > ) || (_infoindexOf("Linux") > ))); //></SCRIPT></COMMENT> <! applet展示 > <% <applet width= height=> <PARAM NAME=CODE VALUE="<%=appletClass%>"> <PARAM NAME=CODEBASE VALUE="applets"> <PARAM NAME=ARCHIVE VALUE="<%=appletJar%>"> <PARAM NAME="type" VALUE="application/xjavaapplet;version="> <PARAM NAME="scriptable" VALUE="false"> <PARAM NAME="REPORT_URL" VALUE ="<%=queryString%>"> </applet> %> <OBJECT classid="clsid:ADCEDBEFD" type="application/xjavabean;version=" codebase="#Version=" WIDTH="<%=width%>" HEIGHT="<%=height%>"> <PARAM NAME=CODEBASE VALUE="<%=appletCodebase %>"> <PARAM NAME=ARCHIVE VALUE="<%=appletJar%>"> <PARAM NAME=CODE VALUE="<%=appletClass%>"> <PARAM NAME="scriptable" VALUE="false"> <PARAM NAME="REPORT_URL" VALUE="<%=queryString%>"> <comment><EMBED type="application/xjavabean;version=" pluginspage=" CODE="<%=appletClass%>" CODEBASE="<%=appletCodebase %>" ARCHIVE="<%=appletJar %>" WIDTH="<%=width%>" HEIGHT="<%=height%>" REPORT_URL="<%=queryString%>" scriptable=false> <noembed></noembed> </EMBED></comment> </OBJECT> </body> </html>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20006.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.