我知道问题可能已经出现过,但是在Java 7u51之后发生了重大变化。由于applet几乎已经死了,我需要将我项目的applet之一转换为可以在客户端机器上启动的JNLP文件。关于如何使用JSP做任何指针?我是否还需要动态签署JNLP和jar?我目前正在研究Java 7u80。
<%@page pageEncoding="UTF-8"%>
<%@page contentType="application/x-java-jnlp-file" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/security.tld" prefix="sec" %>
<%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", -1);
response.setContentType("application/x-java-jnlp-file");
String strFileName = (String) request.getAttribute("FileName");
HttpSession objHttpSession = request.getSession(false);
String strSessionId = (String)objHttpSession.getAttribute(MWIConstants.SESSION_ID);
if (!(objHttpSession.getId().equalsIgnoreCase(strSessionId)) || null == objHttpSession.getAttribute(MWIConstants.HELPER))
{%>
<logic:redirect forward="LOGIN"/>
<%}
%>
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.7+" codebase="http://localhost:8080/xyz/" href="appletjnlp.jsp">
<information>
<title>ImageViewer</title>
<vendor>Oracle and/or its affiliates.</vendor>
</information>
<resources>
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se" max-heap-size="256m"/>
<jar href="pages/applet/applet.jar"/>
<jar href="pages/applet/one.jar"/>
<jar href="pages/applet/two.jar"/>
<jar href="pages/applet/three.jar"/>
<jar href="pages/applet/four.jar"/>
<jar href="pages/applet/five.jar"/>
<jar href="pages/applet/six.jar"/>
<jar href="pages/applet/seven.jar"/>
</resources>
<applet-desc
documentbase="http://localhost:8080/mwi/pages/"
name="ImageViewer"
main-class="cdac.medinfo.mwt.imaging.imageviewer.ImageApplet"
width="300"
height="300">
<param name='targetVersion' value='1.7'>
<PARAM name="boxbgcolor" value='silver'>
<PARAM name="progressbar" value='true'>
<PARAM NAME="FileName" VALUE='<%= strFileName %>'>
<PARAM NAME="ContextPath" VALUE='<%= request.getContextPath()%>'>
<PARAM NAME="ResponseObject" VALUE='<%=response%>'>
<PARAM NAME="ServerName" VALUE='<%=request.getServerName()%>'>
<PARAM NAME="Port" VALUE='<%= request.getServerPort()%>'>
</applet-desc>
<security>
<all-permissions/>
</security>
<component-desc/>
</jnlp>