①<s:a href="ImageViewApplet.jsp?filePath=%{#ct.imagePath}">预览</s:a>
第一个jsp页面点击事件获得filePath字符串
②ImageViewApplet.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ImageViewApplet</title>
</head>
<body>
<%String s = (String)request.getParameter("filePath");%>
<jsp:plugin type ="applet" code="applet.ImageViewApplet" archive="gdal.jar" width="1040" height="900" align="middle" codebase=".">
<jsp:params>
<jsp:param name="filePath" value="<%=s%>"/>
</jsp:params>
<jsp:fallback>
<p>Unable to load applet</p>
</jsp:fallback>
</jsp:plugin>
</body>
</html>
第二个嵌入applet的jsp获得filePath字符串,然后传给applet
③
public void init()
{
this.filePath = getParameter("filePath");
System.out.println("#####" + filePath);
BufferedImage tmpImage = openFile(new File(this.filePath));
setImage(tmpImage);
}
最后在applet里面获得filePath