日期:2014-05-16  浏览次数:20398 次

jsp。。

<%@ page language="java" import="com.junze.huiju.framework.util.BufferStream" pageEncoding="UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String real=request.getRealPath("");//返回结果如:E:\workspace\ITS\webroot
?BufferStream stream=new BufferStream();
??byte[] temp= stream.BufferStreamForByte(url,1024);
? ?stream.writeByteArryToImage(temp,real+"Trafficimage.jpg");
%>
<img? src="<%=basePath %>Trafficimage.jpg"/>

?

java中replaceAll反斜杠\
http://blog.sina.com.cn/s/blog_3fc066b20100b3zm.html