当前位置:编程学习 > 网站相关 >>

图片保存到硬盘上

我写了一段 可以在页面上显示    但不知道怎样保存到硬盘上
帮忙把剩下的代码给补上   
给加分


<%@ page language="java" import="java.io.*" pageEncoding="ISO-8859-1"%>
<%@page import="java.awt.Image"%>
<%@page import="java.awt.image.BufferedImage"%>
<%@page import="javax.imageio.ImageIO"%>
<%
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>
    <base href="<%=basePath%>">
    
    <title>My JSP 'MyJsp.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
  
  <body>
        <%
        
            File f=new File("F:\\picture\\sd.gif");
            InputStream in=new FileInputStream(f);
            BufferedImage bi = ImageIO.read(in);
            ImageIO.write(bi, "jpg", response.getOutputStream());
            
            
            //File f1=new File("F:\\");
            //OutputStream ou=new FileOutputStream(f1);
           
            
            out.print(bi);
         %>
  </body>
</html>
补充:云计算 ,  OpenAPI
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,