jsp间传值,jsp和applet传值

①<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

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值